1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-15 12:29:26 +01:00

Fixed fields hidden by local variable warnings

This commit is contained in:
Cristian Maglie 2017-01-25 17:08:35 +01:00
parent ffe6aee5a6
commit 0b297d2906
7 changed files with 53 additions and 53 deletions

View File

@ -555,18 +555,18 @@ public class Compiler implements MessageConsumer {
//msg = _("\nThe 'Keyboard' class is only supported on the Arduino Leonardo.\n\n"); //msg = _("\nThe 'Keyboard' class is only supported on the Arduino Leonardo.\n\n");
} }
RunnerException exception = placeException(error, pieces[1], PApplet.parseInt(pieces[2]) - 1); RunnerException ex = placeException(error, pieces[1], PApplet.parseInt(pieces[2]) - 1);
if (exception != null) { if (ex != null) {
String fileName = exception.getCodeFile().getPrettyName(); String fileName = ex.getCodeFile().getPrettyName();
int lineNum = exception.getCodeLine() + 1; int lineNum = ex.getCodeLine() + 1;
s = fileName + ":" + lineNum + ": error: " + error + msg; s = fileName + ":" + lineNum + ": error: " + error + msg;
} }
if (exception != null) { if (ex != null) {
if (this.exception == null || this.exception.getMessage().equals(exception.getMessage())) { if (exception == null || exception.getMessage().equals(ex.getMessage())) {
this.exception = exception; exception = ex;
this.exception.hideStackTrace(); exception.hideStackTrace();
} }
} }
} }

View File

@ -85,17 +85,17 @@ public class GPGDetachedSignatureVerifier extends SignatureVerifier {
} }
} }
private PGPPublicKey readPublicKey(File file, String keyId) throws IOException, PGPException { private PGPPublicKey readPublicKey(File file, String id) throws IOException, PGPException {
InputStream keyIn = null; InputStream keyIn = null;
try { try {
keyIn = new BufferedInputStream(new FileInputStream(file)); keyIn = new BufferedInputStream(new FileInputStream(file));
return readPublicKey(keyIn, keyId); return readPublicKey(keyIn, id);
} finally { } finally {
IOUtils.closeQuietly(keyIn); IOUtils.closeQuietly(keyIn);
} }
} }
private PGPPublicKey readPublicKey(InputStream input, String keyId) throws IOException, PGPException { private PGPPublicKey readPublicKey(InputStream input, String id) throws IOException, PGPException {
PGPPublicKeyRingCollection pgpPub = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input), new BcKeyFingerprintCalculator()); PGPPublicKeyRingCollection pgpPub = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input), new BcKeyFingerprintCalculator());
Iterator<PGPPublicKeyRing> keyRingIter = pgpPub.getKeyRings(); Iterator<PGPPublicKeyRing> keyRingIter = pgpPub.getKeyRings();
@ -106,7 +106,7 @@ public class GPGDetachedSignatureVerifier extends SignatureVerifier {
while (keyIter.hasNext()) { while (keyIter.hasNext()) {
PGPPublicKey key = keyIter.next(); PGPPublicKey key = keyIter.next();
if (Long.toHexString(key.getKeyID()).toUpperCase().endsWith(keyId)) { if (Long.toHexString(key.getKeyID()).toUpperCase().endsWith(id)) {
return key; return key;
} }
} }

View File

@ -81,10 +81,10 @@ public class LibrariesIndexer {
// TODO: resolve libraries inner references // TODO: resolve libraries inner references
} }
private void parseIndex(File indexFile) throws IOException { private void parseIndex(File file) throws IOException {
InputStream indexIn = null; InputStream indexIn = null;
try { try {
indexIn = new FileInputStream(indexFile); indexIn = new FileInputStream(file);
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new MrBeanModule()); mapper.registerModule(new MrBeanModule());
mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);

View File

@ -110,15 +110,15 @@ public abstract class ContributedPlatform extends DownloadableContribution {
ContributedPlatform obj1 = (ContributedPlatform) obj; ContributedPlatform obj1 = (ContributedPlatform) obj;
ContributedPackage parentPackage = getParentPackage(); ContributedPackage parent = getParentPackage();
ContributedPackage parentPackage1 = obj1.getParentPackage(); ContributedPackage parent1 = obj1.getParentPackage();
if (parentPackage == null) { if (parent == null) {
if (parentPackage1 != null) if (parent1 != null)
return false; return false;
} else { } else {
if (parentPackage1 == null) if (parent1 == null)
return false; return false;
if (!parentPackage.getName().equals(parentPackage1.getName())) if (!parent.getName().equals(parent1.getName()))
return false; return false;
} }
if (!getArchitecture().equals(obj1.getArchitecture())) { if (!getArchitecture().equals(obj1.getArchitecture())) {

View File

@ -124,12 +124,12 @@ public class ContributionsIndexer {
tool.setPackage(pack); tool.setPackage(pack);
} }
for (ContributedPlatform platform : pack.getPlatforms()) { for (ContributedPlatform plat : pack.getPlatforms()) {
// Set a reference to parent packages // Set a reference to parent packages
platform.setParentPackage(pack); plat.setParentPackage(pack);
// Resolve tools dependencies (works also as a check for file integrity) // Resolve tools dependencies (works also as a check for file integrity)
platform.resolveToolsDependencies(packagesWithTools); plat.resolveToolsDependencies(packagesWithTools);
} }
} }
@ -166,9 +166,9 @@ public class ContributionsIndexer {
platforms = new LinkedList<>(); platforms = new LinkedList<>();
} }
for (ContributedPlatform contributedPlatform : platforms) { for (ContributedPlatform contributedPlatform : platforms) {
ContributedPlatform platform = targetPackage.findPlatform(contributedPlatform.getArchitecture(), contributedPlatform.getVersion()); ContributedPlatform plat = targetPackage.findPlatform(contributedPlatform.getArchitecture(), contributedPlatform.getVersion());
if (platform != null) { if (plat != null) {
targetPackage.getPlatforms().remove(platform); targetPackage.getPlatforms().remove(plat);
} }
targetPackage.getPlatforms().add(contributedPlatform); targetPackage.getPlatforms().add(contributedPlatform);
} }
@ -253,9 +253,9 @@ public class ContributionsIndexer {
for (File platformFolder : hardwareFolder.listFiles(ONLY_DIRS)) { for (File platformFolder : hardwareFolder.listFiles(ONLY_DIRS)) {
File platformTxt = new File(platformFolder, "platform.txt"); File platformTxt = new File(platformFolder, "platform.txt");
String version = new PreferencesMap(platformTxt).get("version"); String version = new PreferencesMap(platformTxt).get("version");
ContributedPlatform platform = syncHardwareWithFilesystem(pack, platformFolder, platformFolder.getName(), version); ContributedPlatform p = syncHardwareWithFilesystem(pack, platformFolder, platformFolder.getName(), version);
if (platform != null) { if (p != null) {
platform.setReadOnly(true); p.setReadOnly(true);
} }
} }
} }
@ -321,13 +321,13 @@ public class ContributionsIndexer {
} }
private ContributedPlatform syncHardwareWithFilesystem(ContributedPackage pack, File installationFolder, String architecture, String version) { private ContributedPlatform syncHardwareWithFilesystem(ContributedPackage pack, File installationFolder, String architecture, String version) {
ContributedPlatform platform = pack.findPlatform(architecture, version); ContributedPlatform p = pack.findPlatform(architecture, version);
if (platform != null) { if (p != null) {
platform.setInstalled(true); p.setInstalled(true);
platform.setReadOnly(false); p.setReadOnly(false);
platform.setInstalledFolder(installationFolder); p.setInstalledFolder(installationFolder);
} }
return platform; return p;
} }
@Override @Override
@ -348,9 +348,9 @@ public class ContributionsIndexer {
List<ContributedPlatform> platforms = aPackage.getPlatforms().stream().filter(new InstalledPredicate()).collect(Collectors.toList()); List<ContributedPlatform> platforms = aPackage.getPlatforms().stream().filter(new InstalledPredicate()).collect(Collectors.toList());
Collections.sort(platforms, new DownloadableContributionBuiltInAtTheBottomComparator()); Collections.sort(platforms, new DownloadableContributionBuiltInAtTheBottomComparator());
for (ContributedPlatform platform : platforms) { for (ContributedPlatform p : platforms) {
String arch = platform.getArchitecture(); String arch = p.getArchitecture();
File folder = platform.getInstalledFolder(); File folder = p.getInstalledFolder();
try { try {
TargetPlatform targetPlatform = new ContributedTargetPlatform(arch, folder, targetPackage); TargetPlatform targetPlatform = new ContributedTargetPlatform(arch, folder, targetPackage);
@ -377,14 +377,14 @@ public class ContributionsIndexer {
public boolean isContributedToolUsed(ContributedPlatform platformToIgnore, ContributedTool tool) { public boolean isContributedToolUsed(ContributedPlatform platformToIgnore, ContributedTool tool) {
for (ContributedPackage pack : index.getPackages()) { for (ContributedPackage pack : index.getPackages()) {
for (ContributedPlatform platform : pack.getPlatforms()) { for (ContributedPlatform p : pack.getPlatforms()) {
if (platformToIgnore.equals(platform)) { if (platformToIgnore.equals(p)) {
continue; continue;
} }
if (!platform.isInstalled() || platform.isReadOnly()) { if (!p.isInstalled() || p.isReadOnly()) {
continue; continue;
} }
for (ContributedTool requiredTool : platform.getResolvedTools()) { for (ContributedTool requiredTool : p.getResolvedTools()) {
if (requiredTool.equals(tool)) if (requiredTool.equals(tool))
return true; return true;
} }
@ -406,8 +406,8 @@ public class ContributionsIndexer {
if (platformsWithName.size() > 1) { if (platformsWithName.size() > 1) {
platformsWithName = platformsWithName.stream().filter(new BuiltInPredicate().negate()).collect(Collectors.toList()); platformsWithName = platformsWithName.stream().filter(new BuiltInPredicate().negate()).collect(Collectors.toList());
} }
for (ContributedPlatform platform : platformsWithName) { for (ContributedPlatform p : platformsWithName) {
tools.addAll(platform.getResolvedTools()); tools.addAll(p.getResolvedTools());
} }
}); });
} }

View File

@ -156,9 +156,9 @@ public class BaseNoGui {
List<ContributedTool> requiredTools = new ArrayList<>(); List<ContributedTool> requiredTools = new ArrayList<>();
// Add all tools dependencies specified in package index // Add all tools dependencies specified in package index
ContributedPlatform platform = indexer.getContributedPlaform(getTargetPlatform()); ContributedPlatform p = indexer.getContributedPlaform(getTargetPlatform());
if (platform != null) if (p != null)
requiredTools.addAll(platform.getResolvedTools()); requiredTools.addAll(p.getResolvedTools());
// Add all tools dependencies from the (possibily) referenced core // Add all tools dependencies from the (possibily) referenced core
String core = prefs.get("build.core"); String core = prefs.get("build.core");
@ -586,8 +586,8 @@ public class BaseNoGui {
} }
String arch = subFolder.getName(); String arch = subFolder.getName();
try { try {
TargetPlatform platform = new LegacyTargetPlatform(arch, subFolder, targetPackage); TargetPlatform p = new LegacyTargetPlatform(arch, subFolder, targetPackage);
targetPackage.getPlatforms().put(arch, platform); targetPackage.getPlatforms().put(arch, p);
} catch (TargetPlatformException e) { } catch (TargetPlatformException e) {
System.err.println(e.getMessage()); System.err.println(e.getMessage());
} }
@ -668,8 +668,8 @@ public class BaseNoGui {
populateImportToLibraryTable(); populateImportToLibraryTable();
} }
static protected void loadContributedHardware(ContributionsIndexer indexer) { static protected void loadContributedHardware(ContributionsIndexer idx) {
for (TargetPackage pack : indexer.createTargetPackages()) { for (TargetPackage pack : idx.createTargetPackages()) {
packages.put(pack.getId(), pack); packages.put(pack.getId(), pack);
} }
} }

View File

@ -96,8 +96,8 @@ public class LegacyTargetPlatform implements TargetPlatform {
// Create boards // Create boards
Set<String> boardIds = boardsPreferences.keySet(); Set<String> boardIds = boardsPreferences.keySet();
for (String boardId : boardIds) { for (String boardId : boardIds) {
PreferencesMap preferences = boardsPreferences.get(boardId); PreferencesMap prefs = boardsPreferences.get(boardId);
TargetBoard board = new LegacyTargetBoard(boardId, preferences, this); TargetBoard board = new LegacyTargetBoard(boardId, prefs, this);
boards.put(boardId, board); boards.put(boardId, board);
// Pick the first board as default // Pick the first board as default