From 290108eb355de4575f4e1a1bbc9c5e8f0a26152d Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Sat, 18 Nov 2006 18:15:52 +0000 Subject: [PATCH] checkstyle git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@476582 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/BuildEvent.java | 2 +- .../apache/tools/ant/IntrospectionHelper.java | 23 +++++++++++-------- .../org/apache/tools/ant/PropertyHelper.java | 2 -- src/main/org/apache/tools/ant/Task.java | 7 +++--- .../tools/ant/helper/ProjectHelperImpl.java | 4 ++++ .../org/apache/tools/ant/launch/Locator.java | 4 ++-- .../ant/listener/CommonsLoggingListener.java | 2 ++ .../apache/tools/ant/types/Quantifier.java | 2 +- .../ant/types/optional/image/Rotate.java | 6 ++++- .../tools/ant/types/optional/image/Scale.java | 6 ++++- .../ant/types/resources/BZip2Resource.java | 2 +- .../apache/tools/ant/util/JavaEnvUtils.java | 2 +- 12 files changed, 38 insertions(+), 24 deletions(-) diff --git a/src/main/org/apache/tools/ant/BuildEvent.java b/src/main/org/apache/tools/ant/BuildEvent.java index 7437394e5..0780bdeeb 100644 --- a/src/main/org/apache/tools/ant/BuildEvent.java +++ b/src/main/org/apache/tools/ant/BuildEvent.java @@ -189,7 +189,7 @@ public class BuildEvent extends EventObject { * * @return the exception associated with this exception, or * null if no exception has been set. - * + * * @see BuildListener#messageLogged(BuildEvent) * @see BuildListener#taskFinished(BuildEvent) * @see BuildListener#targetFinished(BuildEvent) diff --git a/src/main/org/apache/tools/ant/IntrospectionHelper.java b/src/main/org/apache/tools/ant/IntrospectionHelper.java index df4c11d95..bccc9d885 100644 --- a/src/main/org/apache/tools/ant/IntrospectionHelper.java +++ b/src/main/org/apache/tools/ant/IntrospectionHelper.java @@ -1217,11 +1217,14 @@ public final class IntrospectionHelper { * in detail for reasons of source code readability. */ private abstract static class NestedCreator { - Method method; // the method called to add/create the nested element + private Method method; // the method called to add/create the nested element NestedCreator(Method m) { this.method = m; } + Method getMethod() { + return method; + } boolean isPolyMorphic() { return false; } @@ -1247,7 +1250,7 @@ public final class IntrospectionHelper { Object create(Project project, Object parent, Object ignore) throws InvocationTargetException, IllegalAccessException { - return method.invoke(parent, new Object[] {}); + return getMethod().invoke(parent, new Object[] {}); } } @@ -1257,8 +1260,8 @@ public final class IntrospectionHelper { static final int ADD = 1; static final int ADD_CONFIGURED = 2; - protected Constructor constructor; - protected int behavior; + private Constructor constructor; + private int behavior; // ADD or ADD_CONFIGURED AddNestedCreator(Method m, Constructor c, int behavior) { super(m); @@ -1299,7 +1302,7 @@ public final class IntrospectionHelper { private void istore(Object parent, Object child) throws InvocationTargetException, IllegalAccessException, InstantiationException { - method.invoke(parent, new Object[] {child}); + getMethod().invoke(parent, new Object[] {child}); } } @@ -1308,7 +1311,7 @@ public final class IntrospectionHelper { * in detail for reasons of source code readability. */ private abstract static class AttributeSetter { - Method method; // the method called to set the attribute + private Method method; // the method called to set the attribute AttributeSetter(Method m) { this.method = m; } @@ -1361,8 +1364,8 @@ public final class IntrospectionHelper { return new NestedCreator(addMethod) { Object create(Project project, Object parent, Object ignore) throws InvocationTargetException, IllegalAccessException { - if (!method.getName().endsWith("Configured")) { - method.invoke(parent, new Object[] {realObject}); + if (!getMethod().getName().endsWith("Configured")) { + getMethod().invoke(parent, new Object[] {realObject}); } return nestedObject; } @@ -1374,8 +1377,8 @@ public final class IntrospectionHelper { void store(Object parent, Object child) throws InvocationTargetException, IllegalAccessException, InstantiationException { - if (method.getName().endsWith("Configured")) { - method.invoke(parent, new Object[] {realObject}); + if (getMethod().getName().endsWith("Configured")) { + getMethod().invoke(parent, new Object[] {realObject}); } } }; diff --git a/src/main/org/apache/tools/ant/PropertyHelper.java b/src/main/org/apache/tools/ant/PropertyHelper.java index 9c1d04181..5726bad9c 100644 --- a/src/main/org/apache/tools/ant/PropertyHelper.java +++ b/src/main/org/apache/tools/ant/PropertyHelper.java @@ -464,8 +464,6 @@ public class PropertyHelper { // deprecated, it is possible to use a better (more efficient) // mechanism to preserve the context. - // TODO: do we need to delegate ? - /** * Returns a copy of the properties table. * @return a hashtable containing all properties diff --git a/src/main/org/apache/tools/ant/Task.java b/src/main/org/apache/tools/ant/Task.java index 9baccb087..1ad26b064 100644 --- a/src/main/org/apache/tools/ant/Task.java +++ b/src/main/org/apache/tools/ant/Task.java @@ -337,12 +337,11 @@ public abstract class Task extends ProjectComponent { * @since 1.7 */ public void log(Throwable t, int msgLevel) { - if(t != null) - { + if (t != null) { log(t.getMessage(), t, msgLevel); } } - + /** * Logs a message with the given priority. This delegates * the actual logging to the project. @@ -360,7 +359,7 @@ public abstract class Task extends ProjectComponent { super.log(msg, msgLevel); } } - + /** * Performs this task if it's still valid, or gets a replacement * version and performs that otherwise. diff --git a/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java b/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java index 344a762bc..55f46d8d9 100644 --- a/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java +++ b/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java @@ -180,6 +180,7 @@ public class ProjectHelperImpl extends ProjectHelper { * control back to the parent in the endElement method. */ static class AbstractHandler extends HandlerBase { + // CheckStyle:VisibilityModifier OFF - bc /** * Previous handler for the document. @@ -194,6 +195,7 @@ public class ProjectHelperImpl extends ProjectHelper { explicitly it'll work with more compilers. */ ProjectHelperImpl helperImpl; + // CheckStyle:VisibilityModifier ON /** * Creates a handler and sets the parser to use it @@ -271,7 +273,9 @@ public class ProjectHelperImpl extends ProjectHelper { * Handler for the root element. Its only child must be the "project" element. */ static class RootHandler extends HandlerBase { + // CheckStyle:VisibilityModifier OFF - bc ProjectHelperImpl helperImpl; + // CheckStyle:VisibilityModifier ON public RootHandler(ProjectHelperImpl helperImpl) { this.helperImpl = helperImpl; diff --git a/src/main/org/apache/tools/ant/launch/Locator.java b/src/main/org/apache/tools/ant/launch/Locator.java index 9727de9ec..b4686702a 100644 --- a/src/main/org/apache/tools/ant/launch/Locator.java +++ b/src/main/org/apache/tools/ant/launch/Locator.java @@ -38,7 +38,7 @@ public final class Locator { /** * encoding used to represent URIs */ - public static String URI_ENCODING = "UTF-8"; + public static final String URI_ENCODING = "UTF-8"; // stolen from org.apache.xerces.impl.XMLEntityManager#getUserDir() // of the Xerces-J team // which ASCII characters need to be escaped @@ -210,7 +210,7 @@ public final class Locator { String cwd = System.getProperty("user.dir"); int posi = cwd.indexOf(":"); if ((posi > 0) && path.startsWith(File.separator)) { - path = cwd.substring(0, posi + 1) + path; + path = cwd.substring(0, posi + 1) + path; } } catch (UnsupportedEncodingException exc) { // not sure whether this is clean, but this method is diff --git a/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java b/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java index cb6bc026d..c48087a3b 100644 --- a/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java +++ b/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java @@ -290,8 +290,10 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger { System.setErr(tmpErr); } + // CheckStyle:VisibilityModifier OFF - bc PrintStream out = System.out; PrintStream err = System.err; + // CheckStyle:VisibilityModifier ON /** * Set the the output level. diff --git a/src/main/org/apache/tools/ant/types/Quantifier.java b/src/main/org/apache/tools/ant/types/Quantifier.java index 9683897d9..796ec1640 100755 --- a/src/main/org/apache/tools/ant/types/Quantifier.java +++ b/src/main/org/apache/tools/ant/types/Quantifier.java @@ -51,7 +51,7 @@ public class Quantifier extends EnumeratedAttribute { /** NONE instance */ public static final Quantifier NONE = new Quantifier("none"); - private static abstract class Predicate { + private abstract static class Predicate { abstract boolean eval(int t, int f); } diff --git a/src/main/org/apache/tools/ant/types/optional/image/Rotate.java b/src/main/org/apache/tools/ant/types/optional/image/Rotate.java index 68e77b53d..e20ded1af 100644 --- a/src/main/org/apache/tools/ant/types/optional/image/Rotate.java +++ b/src/main/org/apache/tools/ant/types/optional/image/Rotate.java @@ -45,7 +45,11 @@ public class Rotate extends TransformOperation implements DrawOperation { } - /** {@inheritDoc}. */ + /** + * Rotate an image. + * @param image the image to rotate. + * @return the rotated image. + */ public PlanarImage performRotate(PlanarImage image) { float tAngle = (float) (angle * (Math.PI / HALF_CIRCLE)); ParameterBlock pb = new ParameterBlock(); diff --git a/src/main/org/apache/tools/ant/types/optional/image/Scale.java b/src/main/org/apache/tools/ant/types/optional/image/Scale.java index a8c1b9fe1..0b279e2cd 100644 --- a/src/main/org/apache/tools/ant/types/optional/image/Scale.java +++ b/src/main/org/apache/tools/ant/types/optional/image/Scale.java @@ -103,7 +103,11 @@ public class Scale extends TransformOperation implements DrawOperation { } } - /** {@inheritDoc}. */ + /** + * Scale an image. + * @param image the image to scale. + * @return the scaled image. + */ public PlanarImage performScale(PlanarImage image) { ParameterBlock pb = new ParameterBlock(); pb.addSource(image); diff --git a/src/main/org/apache/tools/ant/types/resources/BZip2Resource.java b/src/main/org/apache/tools/ant/types/resources/BZip2Resource.java index 5483df82b..2b8cf7c8a 100644 --- a/src/main/org/apache/tools/ant/types/resources/BZip2Resource.java +++ b/src/main/org/apache/tools/ant/types/resources/BZip2Resource.java @@ -63,7 +63,7 @@ public class BZip2Resource extends CompressedResource { } /** - * Compress on the fly using {@link CBZip2OuputStream}. + * Compress on the fly using {@link CBZip2OutputStream}. * @param out the stream to wrap. * @return the wrapped stream. * @throws IOException if there is a problem. diff --git a/src/main/org/apache/tools/ant/util/JavaEnvUtils.java b/src/main/org/apache/tools/ant/util/JavaEnvUtils.java index 588249c44..56dad1ccc 100644 --- a/src/main/org/apache/tools/ant/util/JavaEnvUtils.java +++ b/src/main/org/apache/tools/ant/util/JavaEnvUtils.java @@ -161,7 +161,7 @@ public final class JavaEnvUtils { * Note that Ant now requires JDK 1.2+ so {@link #JAVA_1_0} and * {@link #JAVA_1_1} need no longer be tested for. * @param version the version to check against the current version. - * @return true if the version of Java is the same or higher than the + * @return true if the version of Java is the same or higher than the * given version. * @since Ant 1.7 */