ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject svn commit: r475973 - in /ant/core/trunk/src/main/org/apache/tools/ant/types/resources: ./ comparators/ selectors/
Date Thu, 16 Nov 2006 23:13:43 GMT
Author: peterreilly
Date: Thu Nov 16 15:13:42 2006
New Revision: 475973

URL: http://svn.apache.org/viewvc?view=rev&rev=475973
Log:
checkstyle

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BZip2Resource.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionWrapper.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FailFast.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Files.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/GZipResource.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Resources.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Sort.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Tokens.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Touchable.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/comparators/DelegatedResourceComparator.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/comparators/ResourceComparator.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/Compare.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/ResourceSelector.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/ResourceSelectorContainer.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BZip2Resource.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BZip2Resource.java?view=diff&rev=475973&r1=475972&r2=475973
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BZip2Resource.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BZip2Resource.java Thu Nov
16 15:13:42 2006
@@ -35,13 +35,24 @@
 public class BZip2Resource extends CompressedResource {
     private static final char[] MAGIC = new char[] {'B', 'Z'};
 
+    /** A no-arg constructor */
     public BZip2Resource() {
     }
 
+    /**
+     * Constructor with another resource to wrap.
+     * @param other the resource to wrap.
+     */
     public BZip2Resource(org.apache.tools.ant.types.ResourceCollection other) {
         super(other);
     }
 
+    /**
+     * Decompress on the fly using {@link CBZip2InputStream}.
+     * @param in the stream to wrap.
+     * @return the wrapped stream.
+     * @throws IOException if there is a problem.
+     */
     protected InputStream wrapStream(InputStream in) throws IOException {
         for (int i = 0; i < MAGIC.length; i++) {
             if (in.read() != MAGIC[i]) {
@@ -50,13 +61,25 @@
         }
         return new CBZip2InputStream(in);
     }
+
+    /**
+     * Compress on the fly using {@link CBZip2OuputStream}.
+     * @param out the stream to wrap.
+     * @return the wrapped stream.
+     * @throws IOException if there is a problem.
+     */
     protected OutputStream wrapStream(OutputStream out) throws IOException {
         for (int i = 0; i < MAGIC.length; i++) {
             out.write(MAGIC[i]);
         }
         return new CBZip2OutputStream(out);
     }
+
+    /**
+     * Get the name of the compression method.
+     * @return the string "Bzip2".
+     */
     protected String getCompressionName() {
         return "Bzip2";
     }
-}
\ No newline at end of file
+}

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java?view=diff&rev=475973&r1=475972&r2=475973
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java
Thu Nov 16 15:13:42 2006
@@ -112,7 +112,7 @@
      * are added to this container while the Iterator is in use.
      * @return a "fail-fast" Iterator.
      */
-    public synchronized final Iterator iterator() {
+    public final synchronized Iterator iterator() {
         if (isReference()) {
             return ((BaseResourceCollectionContainer) getCheckedRef()).iterator();
         }
@@ -190,7 +190,7 @@
      * Get the nested ResourceCollections.
      * @return List.
      */
-    protected synchronized final List getResourceCollections() {
+    protected final synchronized List getResourceCollections() {
         dieOnCircularReference();
         return Collections.unmodifiableList(rc);
     }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionWrapper.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionWrapper.java?view=diff&rev=475973&r1=475972&r2=475973
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionWrapper.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionWrapper.java
Thu Nov 16 15:13:42 2006
@@ -80,7 +80,7 @@
      * Fulfill the ResourceCollection contract.
      * @return an Iterator of Resources.
      */
-    public synchronized final Iterator iterator() {
+    public final synchronized Iterator iterator() {
         if (isReference()) {
             return ((BaseResourceCollectionWrapper) getCheckedRef()).iterator();
         }
@@ -152,7 +152,7 @@
      * @return a ResourceCollection.
      * @throws BuildException if no nested ResourceCollection has been provided.
      */
-    protected synchronized final ResourceCollection getResourceCollection() {
+    protected final synchronized ResourceCollection getResourceCollection() {
         dieOnCircularReference();
         if (rc == null) {
             throw oneNested();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FailFast.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FailFast.java?view=diff&rev=475973&r1=475972&r2=475973
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FailFast.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FailFast.java Thu Nov 16
15:13:42 2006
@@ -30,30 +30,30 @@
  * @since Ant 1.7
  */
 /*package-private*/ class FailFast implements Iterator {
-    private static final WeakHashMap map = new WeakHashMap();
+    private static final WeakHashMap MAP = new WeakHashMap();
 
     /**
      * Invalidate any in-use Iterators from the specified Object.
      * @param o the parent Object.
      */
     static synchronized void invalidate(Object o) {
-        Set s = (Set) (map.get(o));
+        Set s = (Set) (MAP.get(o));
         if (s != null) {
             s.clear();
         }
     }
 
     private static synchronized void add(FailFast f) {
-        Set s = (Set) (map.get(f.parent));
+        Set s = (Set) (MAP.get(f.parent));
         if (s == null) {
             s = new HashSet();
-            map.put(f.parent, s);
+            MAP.put(f.parent, s);
         }
         s.add(f);
     }
 
     private static synchronized void remove(FailFast f) {
-        Set s = (Set) (map.get(f.parent));
+        Set s = (Set) (MAP.get(f.parent));
         if (s != null) {
             s.remove(f);
         }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Files.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Files.java?view=diff&rev=475973&r1=475972&r2=475973
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Files.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Files.java Thu Nov 16 15:13:42
2006
@@ -81,6 +81,7 @@
      * <p>You must not set another attribute or nest elements inside
      * this element if you make it a reference.</p>
      * @param r the <code>Reference</code> to use.
+     * @throws BuildException if there is a problem.
      */
     public void setRefid(Reference r) throws BuildException {
         if (hasPatterns(defaultPatterns)) {
@@ -221,6 +222,7 @@
      * Set the <code>File</code> containing the includes patterns.
      *
      * @param incl <code>File</code> instance.
+     * @throws BuildException if there is a problem.
      */
     public synchronized void setIncludesfile(File incl) throws BuildException {
         checkAttributesAllowed();
@@ -232,6 +234,7 @@
      * Set the <code>File</code> containing the excludes patterns.
      *
      * @param excl <code>File</code> instance.
+     * @throws BuildException if there is a problem.
      */
     public synchronized void setExcludesfile(File excl) throws BuildException {
         checkAttributesAllowed();
@@ -252,6 +255,7 @@
 
     /**
      * Get whether default exclusions should be used or not.
+     * @return the defaultexclusions value.
      */
     public synchronized boolean getDefaultexcludes() {
         return (isReference())

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/GZipResource.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/GZipResource.java?view=diff&rev=475973&r1=475972&r2=475973
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/GZipResource.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/GZipResource.java Thu Nov
16 15:13:42 2006
@@ -33,20 +33,43 @@
  */
 public class GZipResource extends CompressedResource {
 
+    /** A no-arg constructor */
     public GZipResource() {
     }
 
+    /**
+     * Constructor with another resource to wrap.
+     * @param other the resource to wrap.
+     */
     public GZipResource(org.apache.tools.ant.types.ResourceCollection other) {
         super(other);
     }
 
+    /**
+     * Decompress on the fly using java.util.zip.GZIPInputStream.
+     * @param in the stream to wrap.
+     * @return the wrapped stream.
+     * @throws IOException if there is a problem.
+     */
     protected InputStream wrapStream(InputStream in) throws IOException {
         return new GZIPInputStream(in);
     }
-    protected OutputStream wrapStream(OutputStream out) throws IOException {
+
+    /**
+     * Compress on the fly using java.util.zip.GZIPOutStream.
+     * @param out the stream to wrap.
+     * @return the wrapped stream.
+     * @throws IOException if there is a problem.
+     */
+     protected OutputStream wrapStream(OutputStream out) throws IOException {
         return new GZIPOutputStream(out);
     }
+
+    /**
+     * Get the name of the compression method.
+     * @return the string "GZip".
+     */
     protected String getCompressionName() {
         return "GZip";
     }
-}
\ No newline at end of file
+}

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Resources.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Resources.java?view=diff&rev=475973&r1=475972&r2=475973
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Resources.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Resources.java Thu Nov 16
15:13:42 2006
@@ -61,7 +61,7 @@
     };
 
     private class MyCollection extends AbstractCollection {
-        int size;
+        private int size;
 
         MyCollection() {
             size = 0;
@@ -76,8 +76,8 @@
             return new MyIterator();
         }
         private class MyIterator implements Iterator {
-            Iterator rci = rc.iterator();
-            Iterator ri = null;
+            private Iterator rci = rc.iterator();
+            private Iterator ri = null;
 
             public boolean hasNext() {
                 boolean result = ri != null && ri.hasNext();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Sort.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Sort.java?view=diff&rev=475973&r1=475972&r2=475973
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Sort.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Sort.java Thu Nov 16 15:13:42
2006
@@ -42,7 +42,7 @@
     //sorted bag impl. borrowed from commons-collections TreeBag:
     private static class SortedBag extends AbstractCollection {
         private class MutableInt {
-            int value = 0;
+            private int value = 0;
         }
         private class MyIterator implements Iterator {
             private Iterator keyIter = t.keySet().iterator();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Tokens.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Tokens.java?view=diff&rev=475973&r1=475972&r2=475973
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Tokens.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Tokens.java Thu Nov 16 15:13:42
2006
@@ -29,7 +29,6 @@
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.types.DataType;
 import org.apache.tools.ant.types.ResourceCollection;
-import org.apache.tools.ant.types.resources.StringResource;
 import org.apache.tools.ant.util.ConcatResourceInputStream;
 import org.apache.tools.ant.util.LineTokenizer;
 import org.apache.tools.ant.util.Tokenizer;

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Touchable.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Touchable.java?view=diff&rev=475973&r1=475972&r2=475973
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Touchable.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Touchable.java Thu Nov 16
15:13:42 2006
@@ -23,5 +23,10 @@
  * @since Ant 1.7
  */
 public interface Touchable {
+    /**
+     * Method called to "touch" the resource.
+     * @param modTime the time to set the modified "field" of the resource,
+     *                measured in milliseconds since the epoch.
+     */
     void touch(long modTime);
 }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/comparators/DelegatedResourceComparator.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/comparators/DelegatedResourceComparator.java?view=diff&rev=475973&r1=475972&r2=475973
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/comparators/DelegatedResourceComparator.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/comparators/DelegatedResourceComparator.java
Thu Nov 16 15:13:42 2006
@@ -21,11 +21,10 @@
 import java.util.Vector;
 import java.util.Iterator;
 
+import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.types.DataType;
 import org.apache.tools.ant.types.Resource;
-import org.apache.tools.ant.types.ResourceCollection;
-import org.apache.tools.ant.types.resources.comparators.ResourceComparator;
 
 /**
  * Delegates to other ResourceComparators or, if none specified,
@@ -51,7 +50,12 @@
         v.add(c);
     }
 
-    //inherit doc
+    /**
+     * Equality method based on the vector of resources,
+     * or if a reference, the referredto object.
+     * @param o the object to check against.
+     * @return true if there is equality.
+     */
     public synchronized boolean equals(Object o) {
         if (o == this) {
             return true;
@@ -66,7 +70,18 @@
         return v == null ? ov == null : v.equals(ov);
     }
 
-    //inherit doc
+    /**
+     * Hashcode based on the rules for equality.
+     * @return a hashcode.
+     */
+    public synchronized int hashCode() {
+        if (isReference()) {
+            return getCheckedRef().hashCode();
+        }
+        return v == null ? 0 : v.hashCode();
+    }
+
+    /** {@inheritDoc} */
     protected synchronized int resourceCompare(Resource foo, Resource bar) {
         //if no nested, natural order:
         if (v == null || v.isEmpty()) {
@@ -86,7 +101,8 @@
      * @param p   the Project to resolve against.
      * @throws BuildException on error.
      */
-    protected void dieOnCircularReference(Stack stk, Project p) {
+    protected void dieOnCircularReference(Stack stk, Project p)
+        throws BuildException {
         if (isChecked()) {
             return;
         }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/comparators/ResourceComparator.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/comparators/ResourceComparator.java?view=diff&rev=475973&r1=475972&r2=475973
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/comparators/ResourceComparator.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/comparators/ResourceComparator.java
Thu Nov 16 15:13:42 2006
@@ -59,6 +59,17 @@
     }
 
     /**
+     * Hashcode based on the rules for equality.
+     * @return a hashcode.
+     */
+    public synchronized int hashCode() {
+        if (isReference()) {
+            return getCheckedRef().hashCode();
+        }
+        return getClass().hashCode();
+    }
+
+    /**
      * Compare two Resources.
      * @param foo the first Resource.
      * @param bar the second Resource.

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/Compare.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/Compare.java?view=diff&rev=475973&r1=475972&r2=475973
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/Compare.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/Compare.java Thu
Nov 16 15:13:42 2006
@@ -99,6 +99,7 @@
     }
 
     //implement ResourceSelector; inherit doc
+    /** {@inheritDoc} */
     public synchronized boolean isSelected(Resource r) {
         if (isReference()) {
             return ((ResourceSelector) getCheckedRef()).isSelected(r);

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/ResourceSelector.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/ResourceSelector.java?view=diff&rev=475973&r1=475972&r2=475973
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/ResourceSelector.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/ResourceSelector.java
Thu Nov 16 15:13:42 2006
@@ -30,6 +30,6 @@
      * @param r the Resource to check.
      * @return whether the Resource was selected.
      */
-    public boolean isSelected(Resource r);
+    boolean isSelected(Resource r);
 
 }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/ResourceSelectorContainer.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/ResourceSelectorContainer.java?view=diff&rev=475973&r1=475972&r2=475973
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/ResourceSelectorContainer.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/selectors/ResourceSelectorContainer.java
Thu Nov 16 15:13:42 2006
@@ -107,7 +107,8 @@
      * @param p   the Project to resolve against.
      * @throws BuildException on error.
      */
-    protected void dieOnCircularReference(Stack stk, Project p) {
+    protected void dieOnCircularReference(Stack stk, Project p)
+        throws BuildException {
         if (isChecked()) {
             return;
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message