You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jh...@apache.org on 2014/07/04 09:17:59 UTC
[17/17] git commit: checkstyle
checkstyle
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/1b76f1b6
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/1b76f1b6
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/1b76f1b6
Branch: refs/heads/master
Commit: 1b76f1b6dae88a7a158e50222bb19f6f5ca26d70
Parents: bf6026a
Author: Jan Matèrne <jh...@apache.org>
Authored: Fri Jul 4 09:14:00 2014 +0200
Committer: Jan Matèrne <jh...@apache.org>
Committed: Fri Jul 4 09:14:00 2014 +0200
----------------------------------------------------------------------
.../org/apache/tools/ant/AntClassLoader.java | 312 +++++++-------
.../org/apache/tools/ant/ArgumentProcessor.java | 4 +-
.../tools/ant/ArgumentProcessorRegistry.java | 2 +-
.../org/apache/tools/ant/BuildListener.java | 2 +-
.../org/apache/tools/ant/DirectoryScanner.java | 69 +--
src/main/org/apache/tools/ant/Evaluable.java | 2 +-
.../org/apache/tools/ant/ExtensionPoint.java | 9 +-
.../apache/tools/ant/IntrospectionHelper.java | 365 ++++++++--------
src/main/org/apache/tools/ant/Main.java | 283 +++++++------
src/main/org/apache/tools/ant/Project.java | 419 ++++++++++---------
.../org/apache/tools/ant/ProjectHelper.java | 8 +-
.../apache/tools/ant/filters/ConcatFilter.java | 8 +-
.../org/apache/tools/ant/launch/Launcher.java | 82 ++--
.../org/apache/tools/ant/launch/Locator.java | 2 -
.../tools/ant/listener/AnsiColorLogger.java | 5 +-
.../apache/tools/ant/listener/SilentLogger.java | 20 +-
.../apache/tools/ant/taskdefs/AntStructure.java | 77 ++--
.../apache/tools/ant/taskdefs/BindTargets.java | 27 +-
.../apache/tools/ant/taskdefs/Componentdef.java | 2 +-
.../org/apache/tools/ant/taskdefs/Copy.java | 201 ++++-----
.../org/apache/tools/ant/taskdefs/EchoXML.java | 5 +-
src/main/org/apache/tools/ant/taskdefs/Get.java | 39 +-
.../org/apache/tools/ant/taskdefs/Input.java | 34 +-
.../org/apache/tools/ant/taskdefs/JDBCTask.java | 4 +-
.../org/apache/tools/ant/taskdefs/Javac.java | 151 +++----
.../org/apache/tools/ant/taskdefs/Javadoc.java | 20 +-
.../org/apache/tools/ant/taskdefs/MakeUrl.java | 9 +-
.../org/apache/tools/ant/taskdefs/Manifest.java | 34 +-
.../apache/tools/ant/taskdefs/PathConvert.java | 11 +-
.../tools/ant/taskdefs/ProjectHelperTask.java | 5 +-
.../org/apache/tools/ant/taskdefs/Property.java | 15 +-
.../apache/tools/ant/taskdefs/Redirector.java | 161 +++----
.../org/apache/tools/ant/taskdefs/Rmic.java | 13 +-
.../org/apache/tools/ant/taskdefs/SQLExec.java | 17 +-
.../org/apache/tools/ant/taskdefs/SignJar.java | 5 +-
.../org/apache/tools/ant/taskdefs/Sleep.java | 7 +-
.../org/apache/tools/ant/taskdefs/SubAnt.java | 20 +-
.../org/apache/tools/ant/taskdefs/Sync.java | 24 +-
src/main/org/apache/tools/ant/taskdefs/War.java | 13 +-
.../apache/tools/ant/taskdefs/XSLTLiaison.java | 2 +-
.../apache/tools/ant/taskdefs/XSLTLiaison4.java | 2 -
.../apache/tools/ant/taskdefs/XSLTProcess.java | 41 +-
src/main/org/apache/tools/ant/taskdefs/Zip.java | 49 ++-
.../taskdefs/compilers/AptCompilerAdapter.java | 13 +-
.../compilers/CompilerAdapterExtension.java | 4 +-
.../compilers/DefaultCompilerAdapter.java | 69 +--
.../ant/taskdefs/condition/IsReachable.java | 11 +-
.../ant/taskdefs/cvslib/ChangeLogParser.java | 4 +-
.../tools/ant/taskdefs/cvslib/CvsTagDiff.java | 10 +-
.../ant/taskdefs/launcher/CommandLauncher.java | 4 +-
.../taskdefs/launcher/CommandLauncherProxy.java | 2 +-
.../launcher/Java13CommandLauncher.java | 2 +-
.../taskdefs/launcher/MacCommandLauncher.java | 2 +-
.../taskdefs/launcher/OS2CommandLauncher.java | 2 +-
.../launcher/PerlScriptCommandLauncher.java | 2 +-
.../launcher/ScriptCommandLauncher.java | 2 +-
.../taskdefs/launcher/VmsCommandLauncher.java | 4 +-
.../taskdefs/launcher/WinNTCommandLauncher.java | 2 +-
.../ant/taskdefs/optional/PropertyFile.java | 20 +-
.../ant/taskdefs/optional/ReplaceRegExp.java | 7 +-
.../ant/taskdefs/optional/TraXLiaison.java | 35 +-
.../depend/constantpool/MethodTypeCPInfo.java | 13 +-
.../optional/ejb/IPlanetDeploymentTool.java | 23 +-
.../ant/taskdefs/optional/ejb/IPlanetEjbc.java | 1 -
.../optional/extension/ExtensionSet.java | 13 +-
.../optional/junit/JUnit4TestMethodAdapter.java | 21 +-
.../ant/taskdefs/optional/junit/JUnitTask.java | 51 ++-
.../ant/taskdefs/optional/junit/JUnitTest.java | 7 +-
.../optional/junit/JUnitTestRunner.java | 293 +++++++------
.../optional/junit/TearDownOnVmCrash.java | 29 +-
.../optional/junit/XMLJUnitResultFormatter.java | 35 +-
.../taskdefs/optional/net/FTPTaskMirror.java | 3 +-
.../taskdefs/optional/splash/SplashTask.java | 20 +-
.../ant/taskdefs/optional/ssh/Directory.java | 9 +-
.../ant/taskdefs/optional/ssh/SSHExec.java | 90 ++--
.../ant/taskdefs/optional/ssh/SSHSession.java | 10 +-
.../tools/ant/taskdefs/optional/ssh/Scp.java | 12 +-
.../ant/taskdefs/optional/unix/Symlink.java | 17 +-
.../org/apache/tools/ant/types/FilterChain.java | 8 +-
.../org/apache/tools/ant/types/FilterSet.java | 16 +-
.../org/apache/tools/ant/types/Permissions.java | 69 +--
.../tools/ant/types/ResourceCollection.java | 2 -
.../tools/ant/types/mappers/CutDirsMapper.java | 17 +-
.../tools/ant/types/resources/Archives.java | 22 +-
.../resources/ContentTransformingResource.java | 19 +-
.../LazyResourceCollectionWrapper.java | 28 +-
.../ant/types/resources/MappedResource.java | 20 +-
.../ant/types/resources/MultiRootFileSet.java | 32 +-
.../ant/types/resources/selectors/Type.java | 16 +-
.../ant/types/selectors/MappingSelector.java | 8 +-
.../ant/types/selectors/PresentSelector.java | 28 +-
.../ant/types/selectors/TokenizedPath.java | 17 +-
.../apache/tools/ant/util/DOMElementWriter.java | 2 +-
.../org/apache/tools/ant/util/JavaEnvUtils.java | 2 +-
.../ant/util/LayoutPreservingProperties.java | 165 ++++----
.../ant/util/LineOrientedOutputStream.java | 12 +-
.../LineOrientedOutputStreamRedirector.java | 24 +-
.../apache/tools/ant/util/ResourceUtils.java | 224 +++++-----
.../tools/ant/util/SymbolicLinkUtils.java | 5 +-
.../org/apache/tools/ant/util/UnicodeUtil.java | 2 +-
src/main/org/apache/tools/tar/TarConstants.java | 42 +-
.../org/apache/tools/tar/TarInputStream.java | 10 +-
.../org/apache/tools/tar/TarOutputStream.java | 9 +-
src/main/org/apache/tools/tar/TarUtils.java | 31 +-
.../tools/zip/AbstractUnicodeExtraField.java | 19 +-
.../apache/tools/zip/FallbackZipEncoding.java | 17 +-
.../org/apache/tools/zip/GeneralPurposeBit.java | 2 +-
.../org/apache/tools/zip/NioZipEncoding.java | 13 +-
.../apache/tools/zip/Simple8BitZipEncoding.java | 24 +-
.../tools/zip/UnicodeCommentExtraField.java | 9 +-
.../apache/tools/zip/UnicodePathExtraField.java | 11 +-
src/main/org/apache/tools/zip/ZipEncoding.java | 16 +-
.../org/apache/tools/zip/ZipEncodingHelper.java | 138 +++---
src/main/org/apache/tools/zip/ZipEntry.java | 85 ++--
src/main/org/apache/tools/zip/ZipFile.java | 7 +-
.../org/apache/tools/zip/ZipOutputStream.java | 23 +-
src/main/org/apache/tools/zip/ZipUtil.java | 2 +-
117 files changed, 2516 insertions(+), 2102 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/1b76f1b6/src/main/org/apache/tools/ant/AntClassLoader.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/AntClassLoader.java b/src/main/org/apache/tools/ant/AntClassLoader.java
index 6098dec..88a81c4 100644
--- a/src/main/org/apache/tools/ant/AntClassLoader.java
+++ b/src/main/org/apache/tools/ant/AntClassLoader.java
@@ -86,7 +86,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
/**
* The name of the resource being searched for.
*/
- private String resourceName;
+ private final String resourceName;
/**
* The index of the next classpath element to search.
@@ -106,7 +106,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param name the name of the resource to search for.
*/
- ResourceEnumeration(String name) {
+ ResourceEnumeration(final String name) {
this.resourceName = name;
this.pathElementsIndex = 0;
findNextResource();
@@ -119,7 +119,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @return <code>true</code> if there are more elements in the
* enumeration; <code>false</code> otherwise.
*/
- public boolean hasMoreElements() {
+ @Override
+ public boolean hasMoreElements() {
return (this.nextResource != null);
}
@@ -128,8 +129,9 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @return the next resource in the enumeration
*/
- public URL nextElement() {
- URL ret = this.nextResource;
+ @Override
+ public URL nextElement() {
+ final URL ret = this.nextResource;
if (ret == null) {
throw new NoSuchElementException();
}
@@ -147,10 +149,10 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
URL url = null;
while ((pathElementsIndex < pathComponents.size()) && (url == null)) {
try {
- File pathComponent = (File) pathComponents.elementAt(pathElementsIndex);
+ final File pathComponent = pathComponents.elementAt(pathElementsIndex);
url = getResourceURL(pathComponent, this.resourceName);
pathElementsIndex++;
- } catch (BuildException e) {
+ } catch (final BuildException e) {
// ignore path elements which are not valid relative to the
// project
}
@@ -173,7 +175,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* The components of the classpath that the classloader searches
* for classes.
*/
- private Vector<File> pathComponents = new VectorSet<File>();
+ private final Vector<File> pathComponents = new VectorSet<File>();
/**
* The project to which this class loader belongs.
@@ -191,14 +193,14 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* loader regardless of whether the parent class loader is being searched
* first or not.
*/
- private Vector<String> systemPackages = new Vector<String>();
+ private final Vector<String> systemPackages = new Vector<String>();
/**
* These are the package roots that are to be loaded by this class loader
* regardless of whether the parent class loader is being searched first
* or not.
*/
- private Vector<String> loaderPackages = new Vector<String>();
+ private final Vector<String> loaderPackages = new Vector<String>();
/**
* Whether or not this classloader will ignore the base
@@ -219,7 +221,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
private Hashtable<File, JarFile> jarFiles = new Hashtable<File, JarFile>();
/** Static map of jar file/time to manifest class-path entries */
- private static Map<String,String> pathMap = Collections.synchronizedMap(new HashMap<String, String>());
+ private static Map<String, String> pathMap =
+ Collections.synchronizedMap(new HashMap<String, String>());
/**
* The context loader saved when setting the thread's current
@@ -241,7 +244,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* belong.
* @param classpath The classpath to use to load classes.
*/
- public AntClassLoader(ClassLoader parent, Project project, Path classpath) {
+ public AntClassLoader(final ClassLoader parent, final Project project, final Path classpath) {
setParent(parent);
setClassPath(classpath);
setProject(project);
@@ -265,7 +268,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* May be <code>null</code>, in which case no path
* elements are set up to start with.
*/
- public AntClassLoader(Project project, Path classpath) {
+ public AntClassLoader(final Project project, final Path classpath) {
setParent(null);
setProject(project);
setClassPath(classpath);
@@ -288,7 +291,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* load the a class through this loader.
*/
public AntClassLoader(
- ClassLoader parent, Project project, Path classpath, boolean parentFirst) {
+ final ClassLoader parent, final Project project, final Path classpath, final boolean parentFirst) {
this(project, classpath);
if (parent != null) {
setParent(parent);
@@ -309,7 +312,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* classloader should be consulted before trying to
* load the a class through this loader.
*/
- public AntClassLoader(Project project, Path classpath, boolean parentFirst) {
+ public AntClassLoader(final Project project, final Path classpath, final boolean parentFirst) {
this(null, project, classpath, parentFirst);
}
@@ -326,7 +329,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* classloader should be consulted before trying to
* load the a class through this loader.
*/
- public AntClassLoader(ClassLoader parent, boolean parentFirst) {
+ public AntClassLoader(final ClassLoader parent, final boolean parentFirst) {
setParent(parent);
project = null;
this.parentFirst = parentFirst;
@@ -337,7 +340,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param project the project instance
*/
- public void setProject(Project project) {
+ public void setProject(final Project project) {
this.project = project;
if (project != null) {
project.addBuildListener(this);
@@ -351,15 +354,15 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @param classpath the search classpath consisting of directories and
* jar/zip files.
*/
- public void setClassPath(Path classpath) {
+ public void setClassPath(final Path classpath) {
pathComponents.removeAllElements();
if (classpath != null) {
- Path actualClasspath = classpath.concatSystemClasspath("ignore");
- String[] pathElements = actualClasspath.list();
+ final Path actualClasspath = classpath.concatSystemClasspath("ignore");
+ final String[] pathElements = actualClasspath.list();
for (int i = 0; i < pathElements.length; ++i) {
try {
addPathElement(pathElements[i]);
- } catch (BuildException e) {
+ } catch (final BuildException e) {
// ignore path elements which are invalid
// relative to the project
}
@@ -373,7 +376,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param parent the parent class loader.
*/
- public void setParent(ClassLoader parent) {
+ public void setParent(final ClassLoader parent) {
this.parent = parent == null ? AntClassLoader.class.getClassLoader() : parent;
}
@@ -385,7 +388,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @param parentFirst if true, delegate initial class search to the parent
* classloader.
*/
- public void setParentFirst(boolean parentFirst) {
+ public void setParentFirst(final boolean parentFirst) {
this.parentFirst = parentFirst;
}
@@ -397,7 +400,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param priority The logging priority of the message.
*/
- protected void log(String message, int priority) {
+ protected void log(final String message, final int priority) {
if (project != null) {
project.log(message, priority);
}
@@ -443,12 +446,12 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @exception BuildException if the given path element cannot be resolved
* against the project.
*/
- public void addPathElement(String pathElement) throws BuildException {
- File pathComponent = project != null ? project.resolveFile(pathElement) : new File(
+ public void addPathElement(final String pathElement) throws BuildException {
+ final File pathComponent = project != null ? project.resolveFile(pathElement) : new File(
pathElement);
try {
addPathFile(pathComponent);
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new BuildException(e);
}
}
@@ -460,7 +463,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* their CLASSPATH entry in the manifest file.
* @param file the jar file or directory to add.
*/
- public void addPathComponent(File file) {
+ public void addPathComponent(final File file) {
if (pathComponents.contains(file)) {
return;
}
@@ -477,7 +480,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @throws IOException if data needed from the file cannot be read.
*/
- protected void addPathFile(File pathComponent) throws IOException {
+ protected void addPathFile(final File pathComponent) throws IOException {
if (!pathComponents.contains(pathComponent)) {
pathComponents.addElement(pathComponent);
}
@@ -485,14 +488,14 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
return;
}
- String absPathPlusTimeAndLength = pathComponent.getAbsolutePath()
+ final String absPathPlusTimeAndLength = pathComponent.getAbsolutePath()
+ pathComponent.lastModified() + "-" + pathComponent.length();
- String classpath = (String) pathMap.get(absPathPlusTimeAndLength);
+ String classpath = pathMap.get(absPathPlusTimeAndLength);
if (classpath == null) {
JarFile jarFile = null;
try {
jarFile = new JarFile(pathComponent);
- Manifest manifest = jarFile.getManifest();
+ final Manifest manifest = jarFile.getManifest();
if (manifest == null) {
return;
}
@@ -510,19 +513,19 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
}
if (!"".equals(classpath)) {
- URL baseURL = FILE_UTILS.getFileURL(pathComponent);
- StringTokenizer st = new StringTokenizer(classpath);
+ final URL baseURL = FILE_UTILS.getFileURL(pathComponent);
+ final StringTokenizer st = new StringTokenizer(classpath);
while (st.hasMoreTokens()) {
- String classpathElement = st.nextToken();
- URL libraryURL = new URL(baseURL, classpathElement);
+ final String classpathElement = st.nextToken();
+ final URL libraryURL = new URL(baseURL, classpathElement);
if (!libraryURL.getProtocol().equals("file")) {
log("Skipping jar library " + classpathElement
+ " since only relative URLs are supported by this" + " loader",
Project.MSG_VERBOSE);
continue;
}
- String decodedPath = Locator.decodeUri(libraryURL.getFile());
- File libraryFile = new File(decodedPath);
+ final String decodedPath = Locator.decodeUri(libraryURL.getFile());
+ final File libraryFile = new File(decodedPath);
if (libraryFile.exists() && !isInPath(libraryFile)) {
addPathFile(libraryFile);
}
@@ -539,7 +542,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
public String getClasspath() {
final StringBuilder sb = new StringBuilder();
boolean firstPass = true;
- Enumeration<File> componentEnum = pathComponents.elements();
+ final Enumeration<File> componentEnum = pathComponents.elements();
while (componentEnum.hasMoreElements()) {
if (!firstPass) {
sb.append(System.getProperty("path.separator"));
@@ -560,7 +563,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @param isolated Whether or not this classloader should run in
* isolated mode.
*/
- public synchronized void setIsolated(boolean isolated) {
+ public synchronized void setIsolated(final boolean isolated) {
ignoreBase = isolated;
}
@@ -574,7 +577,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @deprecated since 1.6.x.
* Use Class.forName with initialize=true instead.
*/
- public static void initializeClass(Class<?> theClass) {
+ @Deprecated
+ public static void initializeClass(final Class<?> theClass) {
// ***HACK*** We ask the VM to create an instance
// by voluntarily providing illegal arguments to force
// the VM to run the class' static initializer, while
@@ -589,7 +593,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
cons[0].newInstance((Object[]) strs);
// Expecting an exception to be thrown by this call:
// IllegalArgumentException: wrong number of Arguments
- } catch (Exception e) {
+ } catch (final Exception e) {
// Ignore - we are interested only in the side
// effect - that of getting the static initializers
// invoked. As we do not want to call a valid
@@ -616,7 +620,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @param packageRoot The root of all packages to be included.
* Should not be <code>null</code>.
*/
- public void addSystemPackageRoot(String packageRoot) {
+ public void addSystemPackageRoot(final String packageRoot) {
systemPackages.addElement(packageRoot + (packageRoot.endsWith(".") ? "" : "."));
}
@@ -629,7 +633,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @param packageRoot The root of all packages to be included.
* Should not be <code>null</code>.
*/
- public void addLoaderPackageRoot(String packageRoot) {
+ public void addLoaderPackageRoot(final String packageRoot) {
loaderPackages.addElement(packageRoot + (packageRoot.endsWith(".") ? "" : "."));
}
@@ -648,7 +652,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @exception ClassNotFoundException if the requested class does not exist
* on this loader's classpath.
*/
- public Class<?> forceLoadClass(String classname) throws ClassNotFoundException {
+ public Class<?> forceLoadClass(final String classname) throws ClassNotFoundException {
log("force loading " + classname, Project.MSG_DEBUG);
Class<?> theClass = findLoadedClass(classname);
@@ -675,7 +679,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @exception ClassNotFoundException if the requested class does not exist
* on this loader's classpath.
*/
- public Class<?> forceLoadSystemClass(String classname) throws ClassNotFoundException {
+ public Class<?> forceLoadSystemClass(final String classname) throws ClassNotFoundException {
log("force system loading " + classname, Project.MSG_DEBUG);
Class<?> theClass = findLoadedClass(classname);
@@ -695,7 +699,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @return a stream to the required resource or <code>null</code> if the
* resource cannot be found on the loader's classpath.
*/
- public InputStream getResourceAsStream(String name) {
+ @Override
+ public InputStream getResourceAsStream(final String name) {
InputStream resourceStream = null;
if (isParentFirst(name)) {
resourceStream = loadBaseResource(name);
@@ -712,7 +717,9 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
}
if (resourceStream == null && !isParentFirst(name)) {
if (ignoreBase) {
- resourceStream = getRootLoader() == null ? null : getRootLoader().getResourceAsStream(name);
+ resourceStream = getRootLoader() == null
+ ? null
+ : getRootLoader().getResourceAsStream(name);
} else {
resourceStream = loadBaseResource(name);
}
@@ -736,14 +743,14 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @return a stream to the required resource or <code>null</code> if
* the resource cannot be found on the loader's classpath.
*/
- private InputStream loadResource(String name) {
+ private InputStream loadResource(final String name) {
// we need to search the components of the path to see if we can
// find the class we want.
InputStream stream = null;
- Enumeration<File> e = pathComponents.elements();
+ final Enumeration<File> e = pathComponents.elements();
while (e.hasMoreElements() && stream == null) {
- File pathComponent = e.nextElement();
+ final File pathComponent = e.nextElement();
stream = getResourceStream(pathComponent, name);
}
return stream;
@@ -759,7 +766,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @return a stream to the named resource, or <code>null</code> if
* the resource cannot be found.
*/
- private InputStream loadBaseResource(String name) {
+ private InputStream loadBaseResource(final String name) {
return parent == null ? super.getResourceAsStream(name) : parent.getResourceAsStream(name);
}
@@ -775,11 +782,11 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @return a stream to the required resource or <code>null</code> if
* the resource cannot be found in the given file.
*/
- private InputStream getResourceStream(File file, String resourceName) {
+ private InputStream getResourceStream(final File file, final String resourceName) {
try {
- JarFile jarFile = (JarFile) jarFiles.get(file);
+ JarFile jarFile = jarFiles.get(file);
if (jarFile == null && file.isDirectory()) {
- File resource = new File(file, resourceName);
+ final File resource = new File(file, resourceName);
if (resource.exists()) {
return new FileInputStream(resource);
}
@@ -793,14 +800,14 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
}
//to eliminate a race condition, retrieve the entry
//that is in the hash table under that filename
- jarFile = (JarFile) jarFiles.get(file);
+ jarFile = jarFiles.get(file);
}
- JarEntry entry = jarFile.getJarEntry(resourceName);
+ final JarEntry entry = jarFile.getJarEntry(resourceName);
if (entry != null) {
return jarFile.getInputStream(entry);
}
}
- } catch (Exception e) {
+ } catch (final Exception e) {
log("Ignoring Exception " + e.getClass().getName() + ": " + e.getMessage()
+ " reading resource " + resourceName + " from " + file, Project.MSG_VERBOSE);
}
@@ -820,7 +827,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @return whether or not the parent classloader should be checked for a
* resource before this one is.
*/
- private boolean isParentFirst(String resourceName) {
+ private boolean isParentFirst(final String resourceName) {
// default to the global setting and then see
// if this class belongs to a package which has been
// designated to use a specific loader first
@@ -830,15 +837,15 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
boolean useParentFirst = parentFirst;
- for (Enumeration<String> e = systemPackages.elements(); e.hasMoreElements();) {
- String packageName = e.nextElement();
+ for (final Enumeration<String> e = systemPackages.elements(); e.hasMoreElements();) {
+ final String packageName = e.nextElement();
if (resourceName.startsWith(packageName)) {
useParentFirst = true;
break;
}
}
- for (Enumeration<String> e = loaderPackages.elements(); e.hasMoreElements();) {
- String packageName = e.nextElement();
+ for (final Enumeration<String> e = loaderPackages.elements(); e.hasMoreElements();) {
+ final String packageName = e.nextElement();
if (resourceName.startsWith(packageName)) {
useParentFirst = false;
break;
@@ -871,7 +878,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* resource could not be found or the caller doesn't have
* adequate privileges to get the resource.
*/
- public URL getResource(String name) {
+ @Override
+ public URL getResource(final String name) {
// we need to search the components of the path to see if
// we can find the class we want.
URL url = null;
@@ -883,9 +891,9 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
} else {
// try and load from this loader if the parent either didn't find
// it or wasn't consulted.
- Enumeration<File> e = pathComponents.elements();
+ final Enumeration<File> e = pathComponents.elements();
while (e.hasMoreElements() && url == null) {
- File pathComponent = e.nextElement();
+ final File pathComponent = e.nextElement();
url = getResourceURL(pathComponent, name);
if (url != null) {
log("Resource " + name + " loaded from ant loader", Project.MSG_DEBUG);
@@ -917,9 +925,13 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* <p>Would override getResources if that wasn't final in Java
* 1.4.</p>
*
+ * @param name name of the resource
+ * @return possible URLs as enumeration
+ * @throws IOException
+ * @see {@link #findResources(String, boolean)}
* @since Ant 1.8.0
*/
- public Enumeration<URL> getNamedResources(String name)
+ public Enumeration<URL> getNamedResources(final String name)
throws IOException {
return findResources(name, false);
}
@@ -933,7 +945,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @return an enumeration of URLs for the resources
* @exception IOException if I/O errors occurs (can't happen)
*/
- protected Enumeration<URL> findResources(String name) throws IOException {
+ @Override
+ protected Enumeration<URL> findResources(final String name) throws IOException {
return findResources(name, true);
}
@@ -949,10 +962,10 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @return an enumeration of URLs for the resources
* @exception IOException if I/O errors occurs (can't happen)
*/
- protected Enumeration<URL> findResources(String name,
- boolean parentHasBeenSearched)
+ protected Enumeration<URL> findResources(final String name,
+ final boolean parentHasBeenSearched)
throws IOException {
- Enumeration<URL> mine = new ResourceEnumeration(name);
+ final Enumeration<URL> mine = new ResourceEnumeration(name);
Enumeration<URL> base;
if (parent != null && (!parentHasBeenSearched || parent != getParent())) {
// Delegate to the parent:
@@ -989,16 +1002,16 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @return a stream to the required resource or <code>null</code> if the
* resource cannot be found in the given file object.
*/
- protected URL getResourceURL(File file, String resourceName) {
+ protected URL getResourceURL(final File file, final String resourceName) {
try {
- JarFile jarFile = (JarFile) jarFiles.get(file);
+ JarFile jarFile = jarFiles.get(file);
if (jarFile == null && file.isDirectory()) {
- File resource = new File(file, resourceName);
+ final File resource = new File(file, resourceName);
if (resource.exists()) {
try {
return FILE_UTILS.getFileURL(resource);
- } catch (MalformedURLException ex) {
+ } catch (final MalformedURLException ex) {
return null;
}
}
@@ -1006,7 +1019,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
if (jarFile == null) {
if (file.exists()) {
if (!isZip(file)) {
- String msg = "CLASSPATH element " + file
+ final String msg = "CLASSPATH element " + file
+ " is not a JAR.";
log(msg, Project.MSG_WARN);
System.err.println(msg);
@@ -1018,19 +1031,19 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
return null;
}
// potential race-condition
- jarFile = (JarFile) jarFiles.get(file);
+ jarFile = jarFiles.get(file);
}
- JarEntry entry = jarFile.getJarEntry(resourceName);
+ final JarEntry entry = jarFile.getJarEntry(resourceName);
if (entry != null) {
try {
return new URL("jar:" + FILE_UTILS.getFileURL(file) + "!/" + entry);
- } catch (MalformedURLException ex) {
+ } catch (final MalformedURLException ex) {
return null;
}
}
}
- } catch (Exception e) {
- String msg = "Unable to obtain resource from " + file + ": ";
+ } catch (final Exception e) {
+ final String msg = "Unable to obtain resource from " + file + ": ";
log(msg + e, Project.MSG_WARN);
System.err.println(msg);
e.printStackTrace();
@@ -1058,7 +1071,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* on the system classpath (when not in isolated mode) or this loader's
* classpath.
*/
- protected synchronized Class<?> loadClass(String classname, boolean resolve)
+ @Override
+ protected synchronized Class<?> loadClass(final String classname, final boolean resolve)
throws ClassNotFoundException {
// 'sync' is needed - otherwise 2 threads can load the same class
// twice, resulting in LinkageError: duplicated class definition.
@@ -1073,7 +1087,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
theClass = findBaseClass(classname);
log("Class " + classname + " loaded from parent loader " + "(parentFirst)",
Project.MSG_DEBUG);
- } catch (ClassNotFoundException cnfe) {
+ } catch (final ClassNotFoundException cnfe) {
theClass = findClass(classname);
log("Class " + classname + " loaded from ant loader " + "(parentFirst)",
Project.MSG_DEBUG);
@@ -1082,7 +1096,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
try {
theClass = findClass(classname);
log("Class " + classname + " loaded from ant loader", Project.MSG_DEBUG);
- } catch (ClassNotFoundException cnfe) {
+ } catch (final ClassNotFoundException cnfe) {
if (ignoreBase) {
throw cnfe;
}
@@ -1105,7 +1119,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @return the classname in filesystem format (eg java/lang/Integer.class)
*/
- private String getClassFilename(String classname) {
+ private String getClassFilename(final String classname) {
return classname.replace('.', '/') + ".class";
}
@@ -1122,15 +1136,15 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @throws IOException if the class data cannot be read.
*/
- protected Class<?> defineClassFromData(File container, byte[] classData, String classname)
+ protected Class<?> defineClassFromData(final File container, final byte[] classData, final String classname)
throws IOException {
definePackage(container, classname);
- ProtectionDomain currentPd = Project.class.getProtectionDomain();
- String classResource = getClassFilename(classname);
- CodeSource src = new CodeSource(FILE_UTILS.getFileURL(container),
+ final ProtectionDomain currentPd = Project.class.getProtectionDomain();
+ final String classResource = getClassFilename(classname);
+ final CodeSource src = new CodeSource(FILE_UTILS.getFileURL(container),
getCertificates(container,
classResource));
- ProtectionDomain classesPd =
+ final ProtectionDomain classesPd =
new ProtectionDomain(src, currentPd.getPermissions(),
this,
currentPd.getPrincipals());
@@ -1148,18 +1162,18 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @exception IOException if the package information cannot be read from the
* container.
*/
- protected void definePackage(File container, String className) throws IOException {
- int classIndex = className.lastIndexOf('.');
+ protected void definePackage(final File container, final String className) throws IOException {
+ final int classIndex = className.lastIndexOf('.');
if (classIndex == -1) {
return;
}
- String packageName = className.substring(0, classIndex);
+ final String packageName = className.substring(0, classIndex);
if (getPackage(packageName) != null) {
// already defined
return;
}
// define the package now
- Manifest manifest = getJarManifest(container);
+ final Manifest manifest = getJarManifest(container);
if (manifest == null) {
definePackage(packageName, null, null, null, null, null, null, null);
@@ -1179,11 +1193,11 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @exception IOException if the manifest cannot be read.
*/
- private Manifest getJarManifest(File container) throws IOException {
+ private Manifest getJarManifest(final File container) throws IOException {
if (container.isDirectory()) {
return null;
}
- JarFile jarFile = (JarFile) jarFiles.get(container);
+ final JarFile jarFile = jarFiles.get(container);
if (jarFile == null) {
return null;
}
@@ -1201,16 +1215,16 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @exception IOException if the manifest cannot be read.
*/
- private Certificate[] getCertificates(File container, String entry)
+ private Certificate[] getCertificates(final File container, final String entry)
throws IOException {
if (container.isDirectory()) {
return null;
}
- JarFile jarFile = (JarFile) jarFiles.get(container);
+ final JarFile jarFile = jarFiles.get(container);
if (jarFile == null) {
return null;
}
- JarEntry ent = jarFile.getJarEntry(entry);
+ final JarEntry ent = jarFile.getJarEntry(entry);
return ent == null ? null : ent.getCertificates();
}
@@ -1222,8 +1236,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @param packageName the name of the package being defined.
* @param manifest the jar's manifest
*/
- protected void definePackage(File container, String packageName, Manifest manifest) {
- String sectionName = packageName.replace('.', '/') + "/";
+ protected void definePackage(final File container, final String packageName, final Manifest manifest) {
+ final String sectionName = packageName.replace('.', '/') + "/";
String specificationTitle = null;
String specificationVendor = null;
@@ -1234,7 +1248,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
String sealedString = null;
URL sealBase = null;
- Attributes sectionAttributes = manifest.getAttributes(sectionName);
+ final Attributes sectionAttributes = manifest.getAttributes(sectionName);
if (sectionAttributes != null) {
specificationTitle = sectionAttributes.getValue(Name.SPECIFICATION_TITLE);
specificationVendor = sectionAttributes.getValue(Name.SPECIFICATION_VENDOR);
@@ -1244,7 +1258,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
implementationVersion = sectionAttributes.getValue(Name.IMPLEMENTATION_VERSION);
sealedString = sectionAttributes.getValue(Name.SEALED);
}
- Attributes mainAttributes = manifest.getMainAttributes();
+ final Attributes mainAttributes = manifest.getMainAttributes();
if (mainAttributes != null) {
if (specificationTitle == null) {
specificationTitle = mainAttributes.getValue(Name.SPECIFICATION_TITLE);
@@ -1271,7 +1285,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
if (sealedString != null && sealedString.equalsIgnoreCase("true")) {
try {
sealBase = new URL(FileUtils.getFileUtils().toURI(container.getAbsolutePath()));
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
// ignore
}
}
@@ -1295,16 +1309,16 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @exception SecurityException if there is a security problem while
* reading the class from the stream.
*/
- private Class<?> getClassFromStream(InputStream stream, String classname, File container)
+ private Class<?> getClassFromStream(final InputStream stream, final String classname, final File container)
throws IOException, SecurityException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
int bytesRead = -1;
- byte[] buffer = new byte[BUFFER_SIZE];
+ final byte[] buffer = new byte[BUFFER_SIZE];
while ((bytesRead = stream.read(buffer, 0, BUFFER_SIZE)) != -1) {
baos.write(buffer, 0, bytesRead);
}
- byte[] classData = baos.toByteArray();
+ final byte[] classData = baos.toByteArray();
return defineClassFromData(container, classData, classname);
}
@@ -1319,7 +1333,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @exception ClassNotFoundException if the requested class does not exist
* on this loader's classpath.
*/
- public Class<?> findClass(String name) throws ClassNotFoundException {
+ @Override
+ public Class<?> findClass(final String name) throws ClassNotFoundException {
log("Finding class " + name, Project.MSG_DEBUG);
return findClassInComponents(name);
}
@@ -1331,7 +1346,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @return true if the file is in the class path
*/
- protected boolean isInPath(File component) {
+ protected boolean isInPath(final File component) {
return pathComponents.contains(component);
}
@@ -1346,14 +1361,14 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @exception ClassNotFoundException if the requested class does not exist
* on this loader's classpath.
*/
- private Class<?> findClassInComponents(String name)
+ private Class<?> findClassInComponents(final String name)
throws ClassNotFoundException {
// we need to search the components of the path to see if
// we can find the class we want.
- String classFilename = getClassFilename(name);
- Enumeration<File> e = pathComponents.elements();
+ final String classFilename = getClassFilename(name);
+ final Enumeration<File> e = pathComponents.elements();
while (e.hasMoreElements()) {
- File pathComponent = (File) e.nextElement();
+ final File pathComponent = e.nextElement();
InputStream stream = null;
try {
stream = getResourceStream(pathComponent, classFilename);
@@ -1362,9 +1377,9 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
+ classFilename, Project.MSG_DEBUG);
return getClassFromStream(stream, name, pathComponent);
}
- } catch (SecurityException se) {
+ } catch (final SecurityException se) {
throw se;
- } catch (IOException ioe) {
+ } catch (final IOException ioe) {
// ioe.printStackTrace();
log("Exception reading component " + pathComponent + " (reason: "
+ ioe.getMessage() + ")", Project.MSG_VERBOSE);
@@ -1390,7 +1405,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @exception ClassNotFoundException if the requested class does not exist
* on this loader's classpath.
*/
- private Class<?> findBaseClass(String name) throws ClassNotFoundException {
+ private Class<?> findBaseClass(final String name) throws ClassNotFoundException {
return parent == null ? findSystemClass(name) : parent.loadClass(name);
}
@@ -1399,11 +1414,11 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* files are closed.
*/
public synchronized void cleanup() {
- for (Enumeration<JarFile> e = jarFiles.elements(); e.hasMoreElements();) {
- JarFile jarFile = e.nextElement();
+ for (final Enumeration<JarFile> e = jarFiles.elements(); e.hasMoreElements();) {
+ final JarFile jarFile = e.nextElement();
try {
jarFile.close();
- } catch (IOException ioe) {
+ } catch (final IOException ioe) {
// ignore
}
}
@@ -1418,6 +1433,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* Gets the parent as has been specified in the constructor or via
* setParent.
*
+ * @return classloader
* @since Ant 1.8.0
*/
public ClassLoader getConfiguredParent() {
@@ -1429,7 +1445,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param event the buildStarted event
*/
- public void buildStarted(BuildEvent event) {
+ @Override
+ public void buildStarted(final BuildEvent event) {
// Not significant for the class loader.
}
@@ -1439,7 +1456,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param event the buildFinished event
*/
- public void buildFinished(BuildEvent event) {
+ @Override
+ public void buildFinished(final BuildEvent event) {
cleanup();
}
@@ -1452,7 +1470,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @since Ant 1.6.2
*/
- public void subBuildFinished(BuildEvent event) {
+ @Override
+ public void subBuildFinished(final BuildEvent event) {
if (event.getProject() == project) {
cleanup();
}
@@ -1465,7 +1484,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @since Ant 1.6.2
*/
- public void subBuildStarted(BuildEvent event) {
+ @Override
+ public void subBuildStarted(final BuildEvent event) {
// Not significant for the class loader.
}
@@ -1474,7 +1494,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param event the targetStarted event
*/
- public void targetStarted(BuildEvent event) {
+ @Override
+ public void targetStarted(final BuildEvent event) {
// Not significant for the class loader.
}
@@ -1483,7 +1504,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param event the targetFinished event
*/
- public void targetFinished(BuildEvent event) {
+ @Override
+ public void targetFinished(final BuildEvent event) {
// Not significant for the class loader.
}
@@ -1492,7 +1514,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param event the taskStarted event
*/
- public void taskStarted(BuildEvent event) {
+ @Override
+ public void taskStarted(final BuildEvent event) {
// Not significant for the class loader.
}
@@ -1501,7 +1524,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param event the taskFinished event
*/
- public void taskFinished(BuildEvent event) {
+ @Override
+ public void taskFinished(final BuildEvent event) {
// Not significant for the class loader.
}
@@ -1510,7 +1534,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param event the messageLogged event
*/
- public void messageLogged(BuildEvent event) {
+ @Override
+ public void messageLogged(final BuildEvent event) {
// Not significant for the class loader.
}
@@ -1519,10 +1544,10 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* here
*/
public void addJavaLibraries() {
- Vector<String> packages = JavaEnvUtils.getJrePackages();
- Enumeration<String> e = packages.elements();
+ final Vector<String> packages = JavaEnvUtils.getJrePackages();
+ final Enumeration<String> e = packages.elements();
while (e.hasMoreElements()) {
- String packageName = e.nextElement();
+ final String packageName = e.nextElement();
addSystemPackageRoot(packageName);
}
}
@@ -1531,7 +1556,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* Returns a <code>String</code> representing this loader.
* @return the path that this classloader has.
*/
- public String toString() {
+ @Override
+ public String toString() {
return "AntClassLoader[" + getClasspath() + "]";
}
@@ -1545,7 +1571,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
try {
subClassToLoad =
Class.forName("org.apache.tools.ant.loader.AntClassLoader5");
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// this is Java5 but the installation is lacking our subclass
}
}
@@ -1554,10 +1580,10 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
/**
* Factory method
*/
- public static AntClassLoader newAntClassLoader(ClassLoader parent,
- Project project,
- Path path,
- boolean parentFirst) {
+ public static AntClassLoader newAntClassLoader(final ClassLoader parent,
+ final Project project,
+ final Path path,
+ final boolean parentFirst) {
if (subClassToLoad != null) {
return (AntClassLoader)
ReflectUtil.newInstance(subClassToLoad,
@@ -1574,10 +1600,10 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
private static final ZipLong SINGLE_SEGMENT_SPLIT_MARKER =
new ZipLong(0X30304B50L);
- private static boolean isZip(File file) throws IOException {
- byte[] sig = new byte[4];
+ private static boolean isZip(final File file) throws IOException {
+ final byte[] sig = new byte[4];
if (readFully(file, sig)) {
- ZipLong start = new ZipLong(sig);
+ final ZipLong start = new ZipLong(sig);
return ZipLong.LFH_SIG.equals(start) // normal file
|| EOCD_SIG.equals(start) // empty zip
|| ZipLong.DD_SIG.equals(start) // split zip
@@ -1586,8 +1612,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
return false;
}
- private static boolean readFully(File f, byte[] b) throws IOException {
- FileInputStream fis = new FileInputStream(f);
+ private static boolean readFully(final File f, final byte[] b) throws IOException {
+ final FileInputStream fis = new FileInputStream(f);
try {
final int len = b.length;
int count = 0, x = 0;
http://git-wip-us.apache.org/repos/asf/ant/blob/1b76f1b6/src/main/org/apache/tools/ant/ArgumentProcessor.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/ArgumentProcessor.java b/src/main/org/apache/tools/ant/ArgumentProcessor.java
index f93e6c6..07812f2 100644
--- a/src/main/org/apache/tools/ant/ArgumentProcessor.java
+++ b/src/main/org/apache/tools/ant/ArgumentProcessor.java
@@ -27,7 +27,7 @@ import java.util.List;
* ones. It is then recommended to chose specific 'enough' argument name,
* avoiding for instance one letter arguments. By the way, if there any
* conflict, Ant will take precedence.
- *
+ *
* @since 1.9
*/
public interface ArgumentProcessor {
@@ -64,7 +64,7 @@ public interface ArgumentProcessor {
/**
* Print the usage of the supported arguments
- *
+ *
* @see org.apache.tools.ant.Main#printUsage()
*/
void printUsage(PrintStream writer);
http://git-wip-us.apache.org/repos/asf/ant/blob/1b76f1b6/src/main/org/apache/tools/ant/ArgumentProcessorRegistry.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/ArgumentProcessorRegistry.java b/src/main/org/apache/tools/ant/ArgumentProcessorRegistry.java
index e658543..bdb7c0a 100644
--- a/src/main/org/apache/tools/ant/ArgumentProcessorRegistry.java
+++ b/src/main/org/apache/tools/ant/ArgumentProcessorRegistry.java
@@ -39,7 +39,7 @@ import org.apache.tools.ant.util.LoaderUtils;
* <p>
* Use the system property <code>ant.argument-processor.debug</code> to enable
* the print of debug log.
- *
+ *
* @since 1.9
*/
public class ArgumentProcessorRegistry {
http://git-wip-us.apache.org/repos/asf/ant/blob/1b76f1b6/src/main/org/apache/tools/ant/BuildListener.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/BuildListener.java b/src/main/org/apache/tools/ant/BuildListener.java
index 09a77f3..ed6731c 100644
--- a/src/main/org/apache/tools/ant/BuildListener.java
+++ b/src/main/org/apache/tools/ant/BuildListener.java
@@ -37,7 +37,7 @@ public interface BuildListener extends EventListener {
* <p>This event is fired before the project instance is fully
* configured. In particular no properties have been set and the
* project may not know its name or default target, yet.</p>
- *
+ *
* @param event An event with any relevant extra information.
* Must not be <code>null</code>.
*/
http://git-wip-us.apache.org/repos/asf/ant/blob/1b76f1b6/src/main/org/apache/tools/ant/DirectoryScanner.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/DirectoryScanner.java b/src/main/org/apache/tools/ant/DirectoryScanner.java
index 5b37555..cf93eb7 100644
--- a/src/main/org/apache/tools/ant/DirectoryScanner.java
+++ b/src/main/org/apache/tools/ant/DirectoryScanner.java
@@ -145,7 +145,8 @@ public class DirectoryScanner
* Use the {@link #getDefaultExcludes getDefaultExcludes}
* method instead.
*/
- protected static final String[] DEFAULTEXCLUDES = {
+ @Deprecated
+ protected static final String[] DEFAULTEXCLUDES = {
// Miscellaneous typical temporary files
SelectorUtils.DEEP_TREE_MATCH + "/*~",
SelectorUtils.DEEP_TREE_MATCH + "/#*#",
@@ -558,7 +559,7 @@ public class DirectoryScanner
*/
public static String[] getDefaultExcludes() {
synchronized (defaultExcludes) {
- return (String[]) defaultExcludes.toArray(new String[defaultExcludes
+ return defaultExcludes.toArray(new String[defaultExcludes
.size()]);
}
}
@@ -618,7 +619,8 @@ public class DirectoryScanner
*
* @param basedir The base directory to scan.
*/
- public void setBasedir(String basedir) {
+ @Override
+ public void setBasedir(String basedir) {
setBasedir(basedir == null ? (File) null
: new File(basedir.replace('/', File.separatorChar).replace(
'\\', File.separatorChar)));
@@ -630,7 +632,8 @@ public class DirectoryScanner
*
* @param basedir The base directory for scanning.
*/
- public synchronized void setBasedir(File basedir) {
+ @Override
+ public synchronized void setBasedir(File basedir) {
this.basedir = basedir;
}
@@ -640,7 +643,8 @@ public class DirectoryScanner
*
* @return the base directory to be scanned.
*/
- public synchronized File getBasedir() {
+ @Override
+ public synchronized File getBasedir() {
return basedir;
}
@@ -661,7 +665,8 @@ public class DirectoryScanner
* @param isCaseSensitive whether or not the file system should be
* regarded as a case sensitive one.
*/
- public synchronized void setCaseSensitive(boolean isCaseSensitive) {
+ @Override
+ public synchronized void setCaseSensitive(boolean isCaseSensitive) {
this.isCaseSensitive = isCaseSensitive;
}
@@ -719,7 +724,8 @@ public class DirectoryScanner
* list is given, all elements must be
* non-<code>null</code>.
*/
- public synchronized void setIncludes(String[] includes) {
+ @Override
+ public synchronized void setIncludes(String[] includes) {
if (includes == null) {
this.includes = null;
} else {
@@ -742,7 +748,8 @@ public class DirectoryScanner
* should be excluded. If a non-<code>null</code> list is
* given, all elements must be non-<code>null</code>.
*/
- public synchronized void setExcludes(String[] excludes) {
+ @Override
+ public synchronized void setExcludes(String[] excludes) {
if (excludes == null) {
this.excludes = null;
} else {
@@ -807,7 +814,8 @@ public class DirectoryScanner
*
* @param selectors specifies the selectors to be invoked on a scan.
*/
- public synchronized void setSelectors(FileSelector[] selectors) {
+ @Override
+ public synchronized void setSelectors(FileSelector[] selectors) {
this.selectors = selectors;
}
@@ -832,7 +840,8 @@ public class DirectoryScanner
* @exception IllegalStateException if the base directory was set
* incorrectly (i.e. if it doesn't exist or isn't a directory).
*/
- public void scan() throws IllegalStateException {
+ @Override
+ public void scan() throws IllegalStateException {
synchronized (scanLock) {
if (scanning) {
while (scanning) {
@@ -1023,7 +1032,7 @@ public class DirectoryScanner
scandir(myfile, currentPath, true);
}
} else if (myfile.isFile()) {
- String originalpattern = (String) entry.getValue();
+ String originalpattern = entry.getValue();
boolean included = isCaseSensitive()
? originalpattern.equals(currentelement)
: originalpattern.equalsIgnoreCase(currentelement);
@@ -1239,7 +1248,7 @@ public class DirectoryScanner
noLinks.add(newfiles[i]);
}
}
- newfiles = (String[]) (noLinks.toArray(new String[noLinks.size()]));
+ newfiles = (noLinks.toArray(new String[noLinks.size()]));
} else {
directoryNamesFollowed.addFirst(dir.getName());
}
@@ -1424,7 +1433,7 @@ public class DirectoryScanner
}
}
for (Iterator<TokenizedPath> iter = includeNonPatterns.values().iterator();
- iter.hasNext(); ) {
+ iter.hasNext();) {
if (couldHoldIncluded(tokenizedName,
iter.next().toPattern())) {
return true;
@@ -1567,7 +1576,8 @@ public class DirectoryScanner
* @return the names of the files which matched at least one of the
* include patterns and none of the exclude patterns.
*/
- public String[] getIncludedFiles() {
+ @Override
+ public String[] getIncludedFiles() {
String[] files;
synchronized (this) {
if (filesIncluded == null) {
@@ -1602,7 +1612,8 @@ public class DirectoryScanner
*
* @see #slowScan
*/
- public synchronized String[] getNotIncludedFiles() {
+ @Override
+ public synchronized String[] getNotIncludedFiles() {
slowScan();
String[] files = new String[filesNotIncluded.size()];
filesNotIncluded.copyInto(files);
@@ -1620,7 +1631,8 @@ public class DirectoryScanner
*
* @see #slowScan
*/
- public synchronized String[] getExcludedFiles() {
+ @Override
+ public synchronized String[] getExcludedFiles() {
slowScan();
String[] files = new String[filesExcluded.size()];
filesExcluded.copyInto(files);
@@ -1638,7 +1650,8 @@ public class DirectoryScanner
*
* @see #slowScan
*/
- public synchronized String[] getDeselectedFiles() {
+ @Override
+ public synchronized String[] getDeselectedFiles() {
slowScan();
String[] files = new String[filesDeselected.size()];
filesDeselected.copyInto(files);
@@ -1653,7 +1666,8 @@ public class DirectoryScanner
* @return the names of the directories which matched at least one of the
* include patterns and none of the exclude patterns.
*/
- public String[] getIncludedDirectories() {
+ @Override
+ public String[] getIncludedDirectories() {
String[] directories;
synchronized (this) {
if (dirsIncluded == null) {
@@ -1688,7 +1702,8 @@ public class DirectoryScanner
*
* @see #slowScan
*/
- public synchronized String[] getNotIncludedDirectories() {
+ @Override
+ public synchronized String[] getNotIncludedDirectories() {
slowScan();
String[] directories = new String[dirsNotIncluded.size()];
dirsNotIncluded.copyInto(directories);
@@ -1706,7 +1721,8 @@ public class DirectoryScanner
*
* @see #slowScan
*/
- public synchronized String[] getExcludedDirectories() {
+ @Override
+ public synchronized String[] getExcludedDirectories() {
slowScan();
String[] directories = new String[dirsExcluded.size()];
dirsExcluded.copyInto(directories);
@@ -1724,7 +1740,8 @@ public class DirectoryScanner
*
* @see #slowScan
*/
- public synchronized String[] getDeselectedDirectories() {
+ @Override
+ public synchronized String[] getDeselectedDirectories() {
slowScan();
String[] directories = new String[dirsDeselected.size()];
dirsDeselected.copyInto(directories);
@@ -1743,7 +1760,7 @@ public class DirectoryScanner
public synchronized String[] getNotFollowedSymlinks() {
String[] links;
synchronized (this) {
- links = (String[]) notFollowedSymlinks
+ links = notFollowedSymlinks
.toArray(new String[notFollowedSymlinks.size()]);
}
Arrays.sort(links);
@@ -1753,7 +1770,8 @@ public class DirectoryScanner
/**
* Add default exclusions to the current exclusions set.
*/
- public synchronized void addDefaultExcludes() {
+ @Override
+ public synchronized void addDefaultExcludes() {
int excludesLength = excludes == null ? 0 : excludes.length;
String[] newExcludes;
String[] defaultExcludesTemp = getDefaultExcludes();
@@ -1776,7 +1794,8 @@ public class DirectoryScanner
* @return the resource with the given name.
* @since Ant 1.5.2
*/
- public synchronized Resource getResource(String name) {
+ @Override
+ public synchronized Resource getResource(String name) {
return new FileResource(basedir, name);
}
@@ -1847,7 +1866,7 @@ public class DirectoryScanner
al.add(new TokenizedPattern(patterns[i]));
}
}
- return (TokenizedPattern[]) al.toArray(new TokenizedPattern[al.size()]);
+ return al.toArray(new TokenizedPattern[al.size()]);
}
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/1b76f1b6/src/main/org/apache/tools/ant/Evaluable.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/Evaluable.java b/src/main/org/apache/tools/ant/Evaluable.java
index abf2ba2..47f09c7 100644
--- a/src/main/org/apache/tools/ant/Evaluable.java
+++ b/src/main/org/apache/tools/ant/Evaluable.java
@@ -19,7 +19,7 @@ package org.apache.tools.ant;
/**
* Kind of task attribute that can be evaluated before being assigned
- *
+ *
* @see RuntimeConfigurable
*/
public interface Evaluable {
http://git-wip-us.apache.org/repos/asf/ant/blob/1b76f1b6/src/main/org/apache/tools/ant/ExtensionPoint.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/ExtensionPoint.java b/src/main/org/apache/tools/ant/ExtensionPoint.java
index 494c4a2..d944437 100644
--- a/src/main/org/apache/tools/ant/ExtensionPoint.java
+++ b/src/main/org/apache/tools/ant/ExtensionPoint.java
@@ -26,7 +26,6 @@ package org.apache.tools.ant;
public class ExtensionPoint extends Target {
public ExtensionPoint() {
-
}
/**
@@ -45,15 +44,17 @@ public class ExtensionPoint extends Target {
/**
* Throws an exception.
*/
- public final void addTask(Task task) {
+ @Override
+ public final void addTask(Task task) {
throw new BuildException(NO_CHILDREN_ALLOWED);
}
/**
* Throws an exception.
*/
- public final void addDataType(RuntimeConfigurable r) {
+ @Override
+ public final void addDataType(RuntimeConfigurable r) {
throw new BuildException(NO_CHILDREN_ALLOWED);
}
-
+
}