Skip to content

Commit 0b297d2

Browse files
committed
Fixed fields hidden by local variable warnings
1 parent ffe6aee commit 0b297d2

File tree

7 files changed

+53
-53
lines changed

7 files changed

+53
-53
lines changed

arduino-core/src/cc/arduino/Compiler.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -555,18 +555,18 @@ public void message(String s) {
555555
//msg = _("\nThe 'Keyboard' class is only supported on the Arduino Leonardo.\n\n");
556556
}
557557

558-
RunnerException exception = placeException(error, pieces[1], PApplet.parseInt(pieces[2]) - 1);
558+
RunnerException ex = placeException(error, pieces[1], PApplet.parseInt(pieces[2]) - 1);
559559

560-
if (exception != null) {
561-
String fileName = exception.getCodeFile().getPrettyName();
562-
int lineNum = exception.getCodeLine() + 1;
560+
if (ex != null) {
561+
String fileName = ex.getCodeFile().getPrettyName();
562+
int lineNum = ex.getCodeLine() + 1;
563563
s = fileName + ":" + lineNum + ": error: " + error + msg;
564564
}
565565

566-
if (exception != null) {
567-
if (this.exception == null || this.exception.getMessage().equals(exception.getMessage())) {
568-
this.exception = exception;
569-
this.exception.hideStackTrace();
566+
if (ex != null) {
567+
if (exception == null || exception.getMessage().equals(ex.getMessage())) {
568+
exception = ex;
569+
exception.hideStackTrace();
570570
}
571571
}
572572
}

arduino-core/src/cc/arduino/contributions/GPGDetachedSignatureVerifier.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,17 @@ protected boolean verify(File signedFile, File signature, File publicKey) throws
8585
}
8686
}
8787

88-
private PGPPublicKey readPublicKey(File file, String keyId) throws IOException, PGPException {
88+
private PGPPublicKey readPublicKey(File file, String id) throws IOException, PGPException {
8989
InputStream keyIn = null;
9090
try {
9191
keyIn = new BufferedInputStream(new FileInputStream(file));
92-
return readPublicKey(keyIn, keyId);
92+
return readPublicKey(keyIn, id);
9393
} finally {
9494
IOUtils.closeQuietly(keyIn);
9595
}
9696
}
9797

98-
private PGPPublicKey readPublicKey(InputStream input, String keyId) throws IOException, PGPException {
98+
private PGPPublicKey readPublicKey(InputStream input, String id) throws IOException, PGPException {
9999
PGPPublicKeyRingCollection pgpPub = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input), new BcKeyFingerprintCalculator());
100100

101101
Iterator<PGPPublicKeyRing> keyRingIter = pgpPub.getKeyRings();
@@ -106,7 +106,7 @@ private PGPPublicKey readPublicKey(InputStream input, String keyId) throws IOExc
106106
while (keyIter.hasNext()) {
107107
PGPPublicKey key = keyIter.next();
108108

109-
if (Long.toHexString(key.getKeyID()).toUpperCase().endsWith(keyId)) {
109+
if (Long.toHexString(key.getKeyID()).toUpperCase().endsWith(id)) {
110110
return key;
111111
}
112112
}

arduino-core/src/cc/arduino/contributions/libraries/LibrariesIndexer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ public void parseIndex() throws IOException {
8181
// TODO: resolve libraries inner references
8282
}
8383

84-
private void parseIndex(File indexFile) throws IOException {
84+
private void parseIndex(File file) throws IOException {
8585
InputStream indexIn = null;
8686
try {
87-
indexIn = new FileInputStream(indexFile);
87+
indexIn = new FileInputStream(file);
8888
ObjectMapper mapper = new ObjectMapper();
8989
mapper.registerModule(new MrBeanModule());
9090
mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);

arduino-core/src/cc/arduino/contributions/packages/ContributedPlatform.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ public boolean equals(Object obj) {
110110

111111
ContributedPlatform obj1 = (ContributedPlatform) obj;
112112

113-
ContributedPackage parentPackage = getParentPackage();
114-
ContributedPackage parentPackage1 = obj1.getParentPackage();
115-
if (parentPackage == null) {
116-
if (parentPackage1 != null)
113+
ContributedPackage parent = getParentPackage();
114+
ContributedPackage parent1 = obj1.getParentPackage();
115+
if (parent == null) {
116+
if (parent1 != null)
117117
return false;
118118
} else {
119-
if (parentPackage1 == null)
119+
if (parent1 == null)
120120
return false;
121-
if (!parentPackage.getName().equals(parentPackage1.getName()))
121+
if (!parent.getName().equals(parent1.getName()))
122122
return false;
123123
}
124124
if (!getArchitecture().equals(obj1.getArchitecture())) {

arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,12 @@ public void parseIndex() throws Exception {
124124
tool.setPackage(pack);
125125
}
126126

127-
for (ContributedPlatform platform : pack.getPlatforms()) {
127+
for (ContributedPlatform plat : pack.getPlatforms()) {
128128
// Set a reference to parent packages
129-
platform.setParentPackage(pack);
129+
plat.setParentPackage(pack);
130130

131131
// Resolve tools dependencies (works also as a check for file integrity)
132-
platform.resolveToolsDependencies(packagesWithTools);
132+
plat.resolveToolsDependencies(packagesWithTools);
133133
}
134134
}
135135

@@ -166,9 +166,9 @@ private void mergeContributions(File indexFile) throws IOException {
166166
platforms = new LinkedList<>();
167167
}
168168
for (ContributedPlatform contributedPlatform : platforms) {
169-
ContributedPlatform platform = targetPackage.findPlatform(contributedPlatform.getArchitecture(), contributedPlatform.getVersion());
170-
if (platform != null) {
171-
targetPackage.getPlatforms().remove(platform);
169+
ContributedPlatform plat = targetPackage.findPlatform(contributedPlatform.getArchitecture(), contributedPlatform.getVersion());
170+
if (plat != null) {
171+
targetPackage.getPlatforms().remove(plat);
172172
}
173173
targetPackage.getPlatforms().add(contributedPlatform);
174174
}
@@ -253,9 +253,9 @@ private void syncBuiltInPackageWithFilesystem(ContributedPackage pack, File hard
253253
for (File platformFolder : hardwareFolder.listFiles(ONLY_DIRS)) {
254254
File platformTxt = new File(platformFolder, "platform.txt");
255255
String version = new PreferencesMap(platformTxt).get("version");
256-
ContributedPlatform platform = syncHardwareWithFilesystem(pack, platformFolder, platformFolder.getName(), version);
257-
if (platform != null) {
258-
platform.setReadOnly(true);
256+
ContributedPlatform p = syncHardwareWithFilesystem(pack, platformFolder, platformFolder.getName(), version);
257+
if (p != null) {
258+
p.setReadOnly(true);
259259
}
260260
}
261261
}
@@ -321,13 +321,13 @@ private DownloadableContribution syncToolWithFilesystem(ContributedPackage pack,
321321
}
322322

323323
private ContributedPlatform syncHardwareWithFilesystem(ContributedPackage pack, File installationFolder, String architecture, String version) {
324-
ContributedPlatform platform = pack.findPlatform(architecture, version);
325-
if (platform != null) {
326-
platform.setInstalled(true);
327-
platform.setReadOnly(false);
328-
platform.setInstalledFolder(installationFolder);
324+
ContributedPlatform p = pack.findPlatform(architecture, version);
325+
if (p != null) {
326+
p.setInstalled(true);
327+
p.setReadOnly(false);
328+
p.setInstalledFolder(installationFolder);
329329
}
330-
return platform;
330+
return p;
331331
}
332332

333333
@Override
@@ -348,9 +348,9 @@ public List<TargetPackage> createTargetPackages() {
348348
List<ContributedPlatform> platforms = aPackage.getPlatforms().stream().filter(new InstalledPredicate()).collect(Collectors.toList());
349349
Collections.sort(platforms, new DownloadableContributionBuiltInAtTheBottomComparator());
350350

351-
for (ContributedPlatform platform : platforms) {
352-
String arch = platform.getArchitecture();
353-
File folder = platform.getInstalledFolder();
351+
for (ContributedPlatform p : platforms) {
352+
String arch = p.getArchitecture();
353+
File folder = p.getInstalledFolder();
354354

355355
try {
356356
TargetPlatform targetPlatform = new ContributedTargetPlatform(arch, folder, targetPackage);
@@ -377,14 +377,14 @@ public List<TargetPackage> createTargetPackages() {
377377

378378
public boolean isContributedToolUsed(ContributedPlatform platformToIgnore, ContributedTool tool) {
379379
for (ContributedPackage pack : index.getPackages()) {
380-
for (ContributedPlatform platform : pack.getPlatforms()) {
381-
if (platformToIgnore.equals(platform)) {
380+
for (ContributedPlatform p : pack.getPlatforms()) {
381+
if (platformToIgnore.equals(p)) {
382382
continue;
383383
}
384-
if (!platform.isInstalled() || platform.isReadOnly()) {
384+
if (!p.isInstalled() || p.isReadOnly()) {
385385
continue;
386386
}
387-
for (ContributedTool requiredTool : platform.getResolvedTools()) {
387+
for (ContributedTool requiredTool : p.getResolvedTools()) {
388388
if (requiredTool.equals(tool))
389389
return true;
390390
}
@@ -406,8 +406,8 @@ public Set<ContributedTool> getInstalledTools() {
406406
if (platformsWithName.size() > 1) {
407407
platformsWithName = platformsWithName.stream().filter(new BuiltInPredicate().negate()).collect(Collectors.toList());
408408
}
409-
for (ContributedPlatform platform : platformsWithName) {
410-
tools.addAll(platform.getResolvedTools());
409+
for (ContributedPlatform p : platformsWithName) {
410+
tools.addAll(p.getResolvedTools());
411411
}
412412
});
413413
}

arduino-core/src/processing/app/BaseNoGui.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ static public PreferencesMap getBoardPreferences() {
156156
List<ContributedTool> requiredTools = new ArrayList<>();
157157

158158
// Add all tools dependencies specified in package index
159-
ContributedPlatform platform = indexer.getContributedPlaform(getTargetPlatform());
160-
if (platform != null)
161-
requiredTools.addAll(platform.getResolvedTools());
159+
ContributedPlatform p = indexer.getContributedPlaform(getTargetPlatform());
160+
if (p != null)
161+
requiredTools.addAll(p.getResolvedTools());
162162

163163
// Add all tools dependencies from the (possibily) referenced core
164164
String core = prefs.get("build.core");
@@ -586,8 +586,8 @@ private static void loadTargetPackage(TargetPackage targetPackage, File _folder)
586586
}
587587
String arch = subFolder.getName();
588588
try {
589-
TargetPlatform platform = new LegacyTargetPlatform(arch, subFolder, targetPackage);
590-
targetPackage.getPlatforms().put(arch, platform);
589+
TargetPlatform p = new LegacyTargetPlatform(arch, subFolder, targetPackage);
590+
targetPackage.getPlatforms().put(arch, p);
591591
} catch (TargetPlatformException e) {
592592
System.err.println(e.getMessage());
593593
}
@@ -668,8 +668,8 @@ static public void onBoardOrPortChange() {
668668
populateImportToLibraryTable();
669669
}
670670

671-
static protected void loadContributedHardware(ContributionsIndexer indexer) {
672-
for (TargetPackage pack : indexer.createTargetPackages()) {
671+
static protected void loadContributedHardware(ContributionsIndexer idx) {
672+
for (TargetPackage pack : idx.createTargetPackages()) {
673673
packages.put(pack.getId(), pack);
674674
}
675675
}

arduino-core/src/processing/app/debug/LegacyTargetPlatform.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ public LegacyTargetPlatform(String _name, File _folder, TargetPackage parent)
9696
// Create boards
9797
Set<String> boardIds = boardsPreferences.keySet();
9898
for (String boardId : boardIds) {
99-
PreferencesMap preferences = boardsPreferences.get(boardId);
100-
TargetBoard board = new LegacyTargetBoard(boardId, preferences, this);
99+
PreferencesMap prefs = boardsPreferences.get(boardId);
100+
TargetBoard board = new LegacyTargetBoard(boardId, prefs, this);
101101
boards.put(boardId, board);
102102

103103
// Pick the first board as default

0 commit comments

Comments
 (0)