mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-13 10:29:35 +01:00
Fixed fields hidden by local variable warnings
This commit is contained in:
parent
ffe6aee5a6
commit
0b297d2906
@ -555,18 +555,18 @@ public class Compiler implements MessageConsumer {
|
||||
//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) {
|
||||
String fileName = exception.getCodeFile().getPrettyName();
|
||||
int lineNum = exception.getCodeLine() + 1;
|
||||
if (ex != null) {
|
||||
String fileName = ex.getCodeFile().getPrettyName();
|
||||
int lineNum = ex.getCodeLine() + 1;
|
||||
s = fileName + ":" + lineNum + ": error: " + error + msg;
|
||||
}
|
||||
|
||||
if (exception != null) {
|
||||
if (this.exception == null || this.exception.getMessage().equals(exception.getMessage())) {
|
||||
this.exception = exception;
|
||||
this.exception.hideStackTrace();
|
||||
if (ex != null) {
|
||||
if (exception == null || exception.getMessage().equals(ex.getMessage())) {
|
||||
exception = ex;
|
||||
exception.hideStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
try {
|
||||
keyIn = new BufferedInputStream(new FileInputStream(file));
|
||||
return readPublicKey(keyIn, keyId);
|
||||
return readPublicKey(keyIn, id);
|
||||
} finally {
|
||||
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());
|
||||
|
||||
Iterator<PGPPublicKeyRing> keyRingIter = pgpPub.getKeyRings();
|
||||
@ -106,7 +106,7 @@ public class GPGDetachedSignatureVerifier extends SignatureVerifier {
|
||||
while (keyIter.hasNext()) {
|
||||
PGPPublicKey key = keyIter.next();
|
||||
|
||||
if (Long.toHexString(key.getKeyID()).toUpperCase().endsWith(keyId)) {
|
||||
if (Long.toHexString(key.getKeyID()).toUpperCase().endsWith(id)) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
@ -81,10 +81,10 @@ public class LibrariesIndexer {
|
||||
// TODO: resolve libraries inner references
|
||||
}
|
||||
|
||||
private void parseIndex(File indexFile) throws IOException {
|
||||
private void parseIndex(File file) throws IOException {
|
||||
InputStream indexIn = null;
|
||||
try {
|
||||
indexIn = new FileInputStream(indexFile);
|
||||
indexIn = new FileInputStream(file);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.registerModule(new MrBeanModule());
|
||||
mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
|
||||
|
@ -110,15 +110,15 @@ public abstract class ContributedPlatform extends DownloadableContribution {
|
||||
|
||||
ContributedPlatform obj1 = (ContributedPlatform) obj;
|
||||
|
||||
ContributedPackage parentPackage = getParentPackage();
|
||||
ContributedPackage parentPackage1 = obj1.getParentPackage();
|
||||
if (parentPackage == null) {
|
||||
if (parentPackage1 != null)
|
||||
ContributedPackage parent = getParentPackage();
|
||||
ContributedPackage parent1 = obj1.getParentPackage();
|
||||
if (parent == null) {
|
||||
if (parent1 != null)
|
||||
return false;
|
||||
} else {
|
||||
if (parentPackage1 == null)
|
||||
if (parent1 == null)
|
||||
return false;
|
||||
if (!parentPackage.getName().equals(parentPackage1.getName()))
|
||||
if (!parent.getName().equals(parent1.getName()))
|
||||
return false;
|
||||
}
|
||||
if (!getArchitecture().equals(obj1.getArchitecture())) {
|
||||
|
@ -124,12 +124,12 @@ public class ContributionsIndexer {
|
||||
tool.setPackage(pack);
|
||||
}
|
||||
|
||||
for (ContributedPlatform platform : pack.getPlatforms()) {
|
||||
for (ContributedPlatform plat : pack.getPlatforms()) {
|
||||
// Set a reference to parent packages
|
||||
platform.setParentPackage(pack);
|
||||
plat.setParentPackage(pack);
|
||||
|
||||
// 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<>();
|
||||
}
|
||||
for (ContributedPlatform contributedPlatform : platforms) {
|
||||
ContributedPlatform platform = targetPackage.findPlatform(contributedPlatform.getArchitecture(), contributedPlatform.getVersion());
|
||||
if (platform != null) {
|
||||
targetPackage.getPlatforms().remove(platform);
|
||||
ContributedPlatform plat = targetPackage.findPlatform(contributedPlatform.getArchitecture(), contributedPlatform.getVersion());
|
||||
if (plat != null) {
|
||||
targetPackage.getPlatforms().remove(plat);
|
||||
}
|
||||
targetPackage.getPlatforms().add(contributedPlatform);
|
||||
}
|
||||
@ -253,9 +253,9 @@ public class ContributionsIndexer {
|
||||
for (File platformFolder : hardwareFolder.listFiles(ONLY_DIRS)) {
|
||||
File platformTxt = new File(platformFolder, "platform.txt");
|
||||
String version = new PreferencesMap(platformTxt).get("version");
|
||||
ContributedPlatform platform = syncHardwareWithFilesystem(pack, platformFolder, platformFolder.getName(), version);
|
||||
if (platform != null) {
|
||||
platform.setReadOnly(true);
|
||||
ContributedPlatform p = syncHardwareWithFilesystem(pack, platformFolder, platformFolder.getName(), version);
|
||||
if (p != null) {
|
||||
p.setReadOnly(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -321,13 +321,13 @@ public class ContributionsIndexer {
|
||||
}
|
||||
|
||||
private ContributedPlatform syncHardwareWithFilesystem(ContributedPackage pack, File installationFolder, String architecture, String version) {
|
||||
ContributedPlatform platform = pack.findPlatform(architecture, version);
|
||||
if (platform != null) {
|
||||
platform.setInstalled(true);
|
||||
platform.setReadOnly(false);
|
||||
platform.setInstalledFolder(installationFolder);
|
||||
ContributedPlatform p = pack.findPlatform(architecture, version);
|
||||
if (p != null) {
|
||||
p.setInstalled(true);
|
||||
p.setReadOnly(false);
|
||||
p.setInstalledFolder(installationFolder);
|
||||
}
|
||||
return platform;
|
||||
return p;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -348,9 +348,9 @@ public class ContributionsIndexer {
|
||||
List<ContributedPlatform> platforms = aPackage.getPlatforms().stream().filter(new InstalledPredicate()).collect(Collectors.toList());
|
||||
Collections.sort(platforms, new DownloadableContributionBuiltInAtTheBottomComparator());
|
||||
|
||||
for (ContributedPlatform platform : platforms) {
|
||||
String arch = platform.getArchitecture();
|
||||
File folder = platform.getInstalledFolder();
|
||||
for (ContributedPlatform p : platforms) {
|
||||
String arch = p.getArchitecture();
|
||||
File folder = p.getInstalledFolder();
|
||||
|
||||
try {
|
||||
TargetPlatform targetPlatform = new ContributedTargetPlatform(arch, folder, targetPackage);
|
||||
@ -377,14 +377,14 @@ public class ContributionsIndexer {
|
||||
|
||||
public boolean isContributedToolUsed(ContributedPlatform platformToIgnore, ContributedTool tool) {
|
||||
for (ContributedPackage pack : index.getPackages()) {
|
||||
for (ContributedPlatform platform : pack.getPlatforms()) {
|
||||
if (platformToIgnore.equals(platform)) {
|
||||
for (ContributedPlatform p : pack.getPlatforms()) {
|
||||
if (platformToIgnore.equals(p)) {
|
||||
continue;
|
||||
}
|
||||
if (!platform.isInstalled() || platform.isReadOnly()) {
|
||||
if (!p.isInstalled() || p.isReadOnly()) {
|
||||
continue;
|
||||
}
|
||||
for (ContributedTool requiredTool : platform.getResolvedTools()) {
|
||||
for (ContributedTool requiredTool : p.getResolvedTools()) {
|
||||
if (requiredTool.equals(tool))
|
||||
return true;
|
||||
}
|
||||
@ -406,8 +406,8 @@ public class ContributionsIndexer {
|
||||
if (platformsWithName.size() > 1) {
|
||||
platformsWithName = platformsWithName.stream().filter(new BuiltInPredicate().negate()).collect(Collectors.toList());
|
||||
}
|
||||
for (ContributedPlatform platform : platformsWithName) {
|
||||
tools.addAll(platform.getResolvedTools());
|
||||
for (ContributedPlatform p : platformsWithName) {
|
||||
tools.addAll(p.getResolvedTools());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -156,9 +156,9 @@ public class BaseNoGui {
|
||||
List<ContributedTool> requiredTools = new ArrayList<>();
|
||||
|
||||
// Add all tools dependencies specified in package index
|
||||
ContributedPlatform platform = indexer.getContributedPlaform(getTargetPlatform());
|
||||
if (platform != null)
|
||||
requiredTools.addAll(platform.getResolvedTools());
|
||||
ContributedPlatform p = indexer.getContributedPlaform(getTargetPlatform());
|
||||
if (p != null)
|
||||
requiredTools.addAll(p.getResolvedTools());
|
||||
|
||||
// Add all tools dependencies from the (possibily) referenced core
|
||||
String core = prefs.get("build.core");
|
||||
@ -586,8 +586,8 @@ public class BaseNoGui {
|
||||
}
|
||||
String arch = subFolder.getName();
|
||||
try {
|
||||
TargetPlatform platform = new LegacyTargetPlatform(arch, subFolder, targetPackage);
|
||||
targetPackage.getPlatforms().put(arch, platform);
|
||||
TargetPlatform p = new LegacyTargetPlatform(arch, subFolder, targetPackage);
|
||||
targetPackage.getPlatforms().put(arch, p);
|
||||
} catch (TargetPlatformException e) {
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
@ -668,8 +668,8 @@ public class BaseNoGui {
|
||||
populateImportToLibraryTable();
|
||||
}
|
||||
|
||||
static protected void loadContributedHardware(ContributionsIndexer indexer) {
|
||||
for (TargetPackage pack : indexer.createTargetPackages()) {
|
||||
static protected void loadContributedHardware(ContributionsIndexer idx) {
|
||||
for (TargetPackage pack : idx.createTargetPackages()) {
|
||||
packages.put(pack.getId(), pack);
|
||||
}
|
||||
}
|
||||
|
@ -96,8 +96,8 @@ public class LegacyTargetPlatform implements TargetPlatform {
|
||||
// Create boards
|
||||
Set<String> boardIds = boardsPreferences.keySet();
|
||||
for (String boardId : boardIds) {
|
||||
PreferencesMap preferences = boardsPreferences.get(boardId);
|
||||
TargetBoard board = new LegacyTargetBoard(boardId, preferences, this);
|
||||
PreferencesMap prefs = boardsPreferences.get(boardId);
|
||||
TargetBoard board = new LegacyTargetBoard(boardId, prefs, this);
|
||||
boards.put(boardId, board);
|
||||
|
||||
// Pick the first board as default
|
||||
|
Loading…
x
Reference in New Issue
Block a user