From 72621f72077df4b67c31e5b6cae759a8e49c2fed Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Mon, 15 Mar 2004 17:33:09 +0000 Subject: [PATCH] stylecheck git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276239 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/AntTypeDefinition.java | 12 ++++-------- .../org/apache/tools/ant/DirectoryScanner.java | 16 ++++++++-------- .../apache/tools/ant/IntrospectionHelper.java | 6 +++--- src/main/org/apache/tools/ant/ProjectHelper.java | 2 +- src/main/org/apache/tools/ant/Target.java | 1 + 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/main/org/apache/tools/ant/AntTypeDefinition.java b/src/main/org/apache/tools/ant/AntTypeDefinition.java index 6ba8ca181..734a3389a 100644 --- a/src/main/org/apache/tools/ant/AntTypeDefinition.java +++ b/src/main/org/apache/tools/ant/AntTypeDefinition.java @@ -352,17 +352,13 @@ public class AntTypeDefinition { // is the same ClassLoader oldLoader = other.getClassLoader(); ClassLoader newLoader = this.getClassLoader(); - if (oldLoader != null - && newLoader != null + return + newLoader != null + && oldLoader != null && oldLoader instanceof AntClassLoader && newLoader instanceof AntClassLoader && ((AntClassLoader) oldLoader).getClasspath() - .equals(((AntClassLoader) newLoader).getClasspath()) - ) { - return true; - } else { - return false; - } + .equals(((AntClassLoader) newLoader).getClasspath()); } private String extractClassname(Class c) { diff --git a/src/main/org/apache/tools/ant/DirectoryScanner.java b/src/main/org/apache/tools/ant/DirectoryScanner.java index a3edf1ff1..e0af6613e 100644 --- a/src/main/org/apache/tools/ant/DirectoryScanner.java +++ b/src/main/org/apache/tools/ant/DirectoryScanner.java @@ -241,7 +241,7 @@ public class DirectoryScanner private boolean followSymlinks = true; /** Helper. */ - private static final FileUtils fileUtils = FileUtils.newFileUtils(); + private static final FileUtils FILE_UTILS = FileUtils.newFileUtils(); /** Whether or not everything tested so far has been included. */ protected boolean everythingIncluded = true; @@ -684,14 +684,14 @@ public class DirectoryScanner // we need to double check. try { File canonFile = myfile.getCanonicalFile(); - String path = fileUtils.removeLeadingPath(canonBase, + String path = FILE_UTILS.removeLeadingPath(canonBase, canonFile); if (!path.equals(currentelement) || ON_VMS) { myfile = findFile(basedir, currentelement); if (myfile != null) { currentelement = - fileUtils.removeLeadingPath(basedir, - myfile); + FILE_UTILS.removeLeadingPath(basedir, + myfile); } } } catch (IOException ex) { @@ -704,7 +704,7 @@ public class DirectoryScanner if (f.exists()) { // adapt currentelement to the case we've // actually found - currentelement = fileUtils.removeLeadingPath(basedir, + currentelement = FILE_UTILS.removeLeadingPath(basedir, f); myfile = f; } @@ -833,7 +833,7 @@ public class DirectoryScanner Vector noLinks = new Vector(); for (int i = 0; i < newfiles.length; i++) { try { - if (fileUtils.isSymbolicLink(dir, newfiles[i])) { + if (FILE_UTILS.isSymbolicLink(dir, newfiles[i])) { String name = vpath + newfiles[i]; File file = new File(dir, newfiles[i]); if (file.isDirectory()) { @@ -1201,7 +1201,7 @@ public class DirectoryScanner * @since Ant 1.5.2 */ public Resource getResource(String name) { - File f = fileUtils.resolveFile(basedir, name); + File f = FILE_UTILS.resolveFile(basedir, name); return new Resource(name, f.exists(), f.lastModified(), f.isDirectory()); } @@ -1346,7 +1346,7 @@ public class DirectoryScanner if (pathElements.size() > 0) { String current = (String) pathElements.remove(0); try { - if (fileUtils.isSymbolicLink(base, current)) { + if (FILE_UTILS.isSymbolicLink(base, current)) { return true; } else { base = new File(base, current); diff --git a/src/main/org/apache/tools/ant/IntrospectionHelper.java b/src/main/org/apache/tools/ant/IntrospectionHelper.java index 4e0743da0..cd3f8d750 100644 --- a/src/main/org/apache/tools/ant/IntrospectionHelper.java +++ b/src/main/org/apache/tools/ant/IntrospectionHelper.java @@ -27,7 +27,6 @@ import java.util.Hashtable; import java.util.List; import java.util.Locale; import org.apache.tools.ant.types.EnumeratedAttribute; -import org.apache.tools.ant.types.Path; import org.apache.tools.ant.taskdefs.PreSetDef; /** @@ -310,6 +309,7 @@ public final class IntrospectionHelper implements BuildListener { throws InvocationTargetException, IllegalAccessException, InstantiationException { if (child != null) { + // Empty } else if (c.getParameterTypes().length == 0) { child = c.newInstance(new Object[] {}); } else { @@ -925,8 +925,8 @@ public final class IntrospectionHelper implements BuildListener { public void set(Project p, Object parent, String value) throws InvocationTargetException, IllegalAccessException { m.invoke(parent, - new Boolean[] { - new Boolean(Project.toBoolean(value))}); + new Boolean[] {Project.toBoolean(value) + ? Boolean.TRUE : Boolean.FALSE}); } }; diff --git a/src/main/org/apache/tools/ant/ProjectHelper.java b/src/main/org/apache/tools/ant/ProjectHelper.java index 9de54c33b..3540145fb 100644 --- a/src/main/org/apache/tools/ant/ProjectHelper.java +++ b/src/main/org/apache/tools/ant/ProjectHelper.java @@ -508,7 +508,7 @@ public class ProjectHelper { if (index == -1) { return componentName; } - return componentName.substring(index+1); + return componentName.substring(index + 1); } /** diff --git a/src/main/org/apache/tools/ant/Target.java b/src/main/org/apache/tools/ant/Target.java index 12166d5ef..27f7e7290 100644 --- a/src/main/org/apache/tools/ant/Target.java +++ b/src/main/org/apache/tools/ant/Target.java @@ -194,6 +194,7 @@ public class Target implements TaskContainer { /** * Does this target depend on the named target? + * @param other the other named target. * @return true if the target does depend on the named target * @since Ant 1.6 */