From e142e5addaeb50f2c2a7c71c29747150b9fad463 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 13 Dec 2004 09:06:19 +0000 Subject: [PATCH] Make Jikes happy - shadowing and some non-static private finals git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277184 13f79535-47bb-0310-9956-ffa450edef68 --- .../tools/ant/taskdefs/optional/ANTLR.java | 20 ++++++++-------- .../optional/jdepend/JDependTask.java | 24 +++++++++---------- .../taskdefs/optional/script/ScriptDef.java | 8 +++---- .../taskdefs/optional/ssh/ScpFromMessage.java | 4 ++-- .../taskdefs/optional/ssh/ScpToMessage.java | 2 +- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java b/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java index 6b4d34de3..7e65d7aa8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java @@ -47,7 +47,7 @@ public class ANTLR extends Task { private CommandlineJava commandline = new CommandlineJava(); /** the file to process */ - private File target; + private File targetFile; /** where to output the result */ private File outputDirectory; @@ -97,7 +97,7 @@ public class ANTLR extends Task { */ public void setTarget(File target) { log("Setting target to: " + target.toString(), Project.MSG_VERBOSE); - this.target = target; + this.targetFile = target; } /** @@ -262,19 +262,19 @@ public class ANTLR extends Task { //TODO: use ANTLR to parse the grammar file to do this. File generatedFile = getGeneratedFile(); boolean targetIsOutOfDate = - target.lastModified() > generatedFile.lastModified(); + targetFile.lastModified() > generatedFile.lastModified(); boolean superGrammarIsOutOfDate = superGrammar != null && (superGrammar.lastModified() > generatedFile.lastModified()); if (targetIsOutOfDate || superGrammarIsOutOfDate) { if (targetIsOutOfDate) { - log("Compiling " + target + " as it is newer than " + log("Compiling " + targetFile + " as it is newer than " + generatedFile, Project.MSG_VERBOSE); } else if (superGrammarIsOutOfDate) { - log("Compiling " + target + " as " + superGrammar + log("Compiling " + targetFile + " as " + superGrammar + " is newer than " + generatedFile, Project.MSG_VERBOSE); } populateAttributes(); - commandline.createArgument().setValue(target.toString()); + commandline.createArgument().setValue(targetFile.toString()); log(commandline.describeCommand(), Project.MSG_VERBOSE); int err = run(commandline.getCommandline()); @@ -332,13 +332,13 @@ public class ANTLR extends Task { } private void validateAttributes() throws BuildException { - if (target == null || !target.isFile()) { - throw new BuildException("Invalid target: " + target); + if (targetFile == null || !targetFile.isFile()) { + throw new BuildException("Invalid target: " + targetFile); } // if no output directory is specified, used the target's directory if (outputDirectory == null) { - setOutputdirectory(new File(target.getParent())); + setOutputdirectory(new File(targetFile.getParent())); } if (!outputDirectory.isDirectory()) { throw new BuildException("Invalid output directory: " + outputDirectory); @@ -348,7 +348,7 @@ public class ANTLR extends Task { private File getGeneratedFile() throws BuildException { String generatedFileName = null; try { - BufferedReader in = new BufferedReader(new FileReader(target)); + BufferedReader in = new BufferedReader(new FileReader(targetFile)); String line; while ((line = in.readLine()) != null) { int extendsIndex = line.indexOf(" extends "); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java index a39b06f1a..6e784684f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java @@ -474,9 +474,9 @@ public class JDependTask extends Task { // of sourcespath. The code is currently the same - you // need class files in a directory to use this - jar files // coming soon.... - String[] classesPath = getClassespath().list(); - for (int i = 0; i < classesPath.length; i++) { - File f = new File(classesPath[i]); + String[] cP = getClassespath().list(); + for (int i = 0; i < cP.length; i++) { + File f = new File(cP[i]); // not necessary as JDepend would fail, but why loose // some time? if (!f.exists() || !f.isDirectory()) { @@ -502,9 +502,9 @@ public class JDependTask extends Task { // This is the old way and is deprecated - classespath is // the right way to do this and is above - String[] sourcesPath = getSourcespath().list(); - for (int i = 0; i < sourcesPath.length; i++) { - File f = new File(sourcesPath[i]); + String[] sP = getSourcespath().list(); + for (int i = 0; i < sP.length; i++) { + File f = new File(sP[i]); // not necessary as JDepend would fail, but why loose // some time? @@ -618,9 +618,9 @@ public class JDependTask extends Task { if (getSourcespath() != null) { // This is deprecated - use classespath in the future - String[] sourcesPath = getSourcespath().list(); - for (int i = 0; i < sourcesPath.length; i++) { - File f = new File(sourcesPath[i]); + String[] sP = getSourcespath().list(); + for (int i = 0; i < sP.length; i++) { + File f = new File(sP[i]); // not necessary as JDepend would fail, but why loose // some time? @@ -637,9 +637,9 @@ public class JDependTask extends Task { if (getClassespath() != null) { // This is the new way - use classespath - code is the // same for now - String[] classesPath = getClassespath().list(); - for (int i = 0; i < classesPath.length; i++) { - File f = new File(classesPath[i]); + String[] cP = getClassespath().list(); + for (int i = 0; i < cP.length; i++) { + File f = new File(cP[i]); // not necessary as JDepend would fail, but why loose // some time? if (!f.exists() || !f.isDirectory()) { diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java b/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java index 5d5e3d747..efbff36e4 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java @@ -223,13 +223,13 @@ public class ScriptDef extends DefBase { // find the script repository - it is stored in the project Map scriptRepository = null; - Project project = getProject(); - synchronized (project) { + Project p = getProject(); + synchronized (p) { scriptRepository = - (Map) project.getReference(MagicNames.SCRIPT_REPOSITORY); + (Map) p.getReference(MagicNames.SCRIPT_REPOSITORY); if (scriptRepository == null) { scriptRepository = new HashMap(); - project.addReference(MagicNames.SCRIPT_REPOSITORY, + p.addReference(MagicNames.SCRIPT_REPOSITORY, scriptRepository); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java index b8e77581d..247402856 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java @@ -31,8 +31,8 @@ import com.jcraft.jsch.Channel; public class ScpFromMessage extends AbstractSshMessage { - private final byte LINE_FEED = 0x0a; - private final int BUFFER_SIZE = 1024; + private static final byte LINE_FEED = 0x0a; + private static final int BUFFER_SIZE = 1024; private String remoteFile; private File localFile; diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessage.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessage.java index b6763ff4b..b13fbf237 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessage.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessage.java @@ -30,7 +30,7 @@ import java.util.Iterator; public class ScpToMessage extends AbstractSshMessage { - private final int BUFFER_SIZE = 1024; + private static final int BUFFER_SIZE = 1024; private File localFile; private String remotePath;