ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r721698 - in /ant/core/trunk/src/main/org/apache/tools/ant/types: ./ resources/ resources/comparators/ resources/selectors/
Date Sat, 29 Nov 2008 18:03:30 GMT
Author: bodewig
Date: Sat Nov 29 10:03:29 2008
New Revision: 721698

URL: http://svn.apache.org/viewvc?rev=721698&view=rev
Log:
simplify

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/types/ArchiveFileSet.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/DataType.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/Path.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/XMLCatalog.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Archives.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/MappedResourceCollection.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/ResourceDecorator.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/Restrict.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/comparators/DelegatedResourceComparator.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/ResourceSelectorContainer.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/ArchiveFileSet.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/ArchiveFileSet.java?rev=721698&r1=721697&r2=721698&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/ArchiveFileSet.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/ArchiveFileSet.java Sat Nov 29 10:03:29
2008
@@ -525,9 +525,7 @@
             super.dieOnCircularReference(stk, p);
         } else {
             if (src != null) {
-                stk.push(src);
-                invokeCircularReferenceCheck(src, stk, p);
-                stk.pop();
+                pushAndInvokeCircularReferenceCheck(src, stk, p);
             }
             setChecked(true);
         }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/DataType.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/DataType.java?rev=721698&r1=721697&r2=721698&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/DataType.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/DataType.java Sat Nov 29 10:03:29 2008
@@ -172,6 +172,26 @@
     }
 
     /**
+     * Allow DataTypes outside org.apache.tools.ant.types to indirectly call
+     * dieOnCircularReference on nested DataTypes.
+     *
+     * <p>Pushes dt on the stack, runs dieOnCircularReference and pops
+     * it again.</p>
+     * @param dt the DataType to check.
+     * @param stk the stack of references to check.
+     * @param p the project to use to dereference the references.
+     * @throws BuildException on error.
+     * @since Ant 1.8.0
+     */
+    public static void pushAndInvokeCircularReferenceCheck(DataType dt,
+                                                           Stack stk,
+                                                           Project p) {
+        stk.push(dt);
+        dt.dieOnCircularReference(stk, p);
+        stk.pop();
+    }
+
+    /**
      * Performs the check for circular references and returns the
      * referenced object.
      * @return the dereferenced object.

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/Path.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/Path.java?rev=721698&r1=721697&r2=721698&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/Path.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/Path.java Sat Nov 29 10:03:29 2008
@@ -478,9 +478,7 @@
             super.dieOnCircularReference(stk, p);
         } else {
             if (union != null) {
-                stk.push(union);
-                invokeCircularReferenceCheck(union, stk, p);
-                stk.pop();
+                pushAndInvokeCircularReferenceCheck(union, stk, p);
             }
             setChecked(true);
         }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/XMLCatalog.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/XMLCatalog.java?rev=721698&r1=721697&r2=721698&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/XMLCatalog.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/XMLCatalog.java Sat Nov 29 10:03:29
2008
@@ -461,14 +461,10 @@
             super.dieOnCircularReference(stk, p);
         } else {
             if (classpath != null) {
-                stk.push(classpath);
-                invokeCircularReferenceCheck(classpath, stk, p);
-                stk.pop();
+                pushAndInvokeCircularReferenceCheck(classpath, stk, p);
             }
             if (catalogPath != null) {
-                stk.push(catalogPath);
-                invokeCircularReferenceCheck(catalogPath, stk, p);
-                stk.pop();
+                pushAndInvokeCircularReferenceCheck(catalogPath, stk, p);
             }
             setChecked(true);
         }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Archives.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Archives.java?rev=721698&r1=721697&r2=721698&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Archives.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Archives.java Sat Nov 29
10:03:29 2008
@@ -183,15 +183,10 @@
         if (isReference()) {
             super.dieOnCircularReference(stk, p);
         } else {
-            checkForCircularReference(zips, stk, p);
-            checkForCircularReference(tars, stk, p);
+            pushAndInvokeCircularReferenceCheck(zips, stk, p);
+            pushAndInvokeCircularReferenceCheck(tars, stk, p);
             setChecked(true);
         }
     }
 
-    protected void checkForCircularReference(DataType t, Stack stk, Project p) {
-        stk.push(t);
-        invokeCircularReferenceCheck(t, stk, p);
-        stk.pop();
-    }
 }
\ 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?rev=721698&r1=721697&r2=721698&view=diff
==============================================================================
--- 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
Sat Nov 29 10:03:29 2008
@@ -185,9 +185,7 @@
             for (Iterator i = rc.iterator(); i.hasNext();) {
                 Object o = i.next();
                 if (o instanceof DataType) {
-                    stk.push(o);
-                    invokeCircularReferenceCheck((DataType) o, stk, p);
-                    stk.pop();
+                    pushAndInvokeCircularReferenceCheck((DataType) o, stk, p);
                 }
             }
             setChecked(true);

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?rev=721698&r1=721697&r2=721698&view=diff
==============================================================================
--- 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
Sat Nov 29 10:03:29 2008
@@ -147,9 +147,7 @@
             super.dieOnCircularReference(stk, p);
         } else {
             if (rc instanceof DataType) {
-                stk.push(rc);
-                invokeCircularReferenceCheck((DataType) rc, stk, p);
-                stk.pop();
+                pushAndInvokeCircularReferenceCheck((DataType) rc, stk, p);
             }
             setChecked(true);
         }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/MappedResourceCollection.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/MappedResourceCollection.java?rev=721698&r1=721697&r2=721698&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/MappedResourceCollection.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/MappedResourceCollection.java
Sat Nov 29 10:03:29 2008
@@ -161,14 +161,10 @@
         } else {
             checkInitialized();
             if (mapper != null) {
-                stk.push(mapper);
-                invokeCircularReferenceCheck(mapper, stk, p);
-                stk.pop();
+                pushAndInvokeCircularReferenceCheck(mapper, stk, p);
             }
             if (nested instanceof DataType) {
-                stk.push(nested);
-                invokeCircularReferenceCheck((DataType) nested, stk, p);
-                stk.pop();
+                pushAndInvokeCircularReferenceCheck((DataType) nested, stk, p);
             }
             setChecked(true);
         }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/ResourceDecorator.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/ResourceDecorator.java?rev=721698&r1=721697&r2=721698&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/ResourceDecorator.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/ResourceDecorator.java Sat
Nov 29 10:03:29 2008
@@ -209,9 +209,7 @@
         if (isReference()) {
             super.dieOnCircularReference(stack, project);
         } else {
-            stack.push(resource);
-            invokeCircularReferenceCheck(resource, stack, project);
-            stack.pop();
+            pushAndInvokeCircularReferenceCheck(resource, stack, project);
             setChecked(true);
         }
     }

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?rev=721698&r1=721697&r2=721698&view=diff
==============================================================================
--- 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 Sat Nov 29
10:03:29 2008
@@ -208,7 +208,7 @@
             for (Iterator i = getNested().iterator(); i.hasNext();) {
                 Object o = i.next();
                 if (o instanceof DataType) {
-                    invokeCircularReferenceCheck((DataType) o, stk, p);
+                    pushAndInvokeCircularReferenceCheck((DataType) o, stk, p);
                 }
             }
             setChecked(true);

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Restrict.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Restrict.java?rev=721698&r1=721697&r2=721698&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Restrict.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Restrict.java Sat Nov 29
10:03:29 2008
@@ -157,9 +157,7 @@
         super.dieOnCircularReference(stk, p);
 
         if (!isReference()) {
-            stk.push(w);
-            invokeCircularReferenceCheck(w, stk, p);
-            stk.pop();
+            pushAndInvokeCircularReferenceCheck(w, stk, p);
             setChecked(true);
         }
     }

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?rev=721698&r1=721697&r2=721698&view=diff
==============================================================================
--- 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 Sat Nov 29 10:03:29
2008
@@ -144,9 +144,7 @@
         if (isReference()) {
             super.dieOnCircularReference(stk, p);
         } else {
-            stk.push(comp);
-            DataType.invokeCircularReferenceCheck(comp, stk, p);
-            stk.pop();
+            DataType.pushAndInvokeCircularReferenceCheck(comp, stk, p);
             setChecked(true);
         }
     }

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?rev=721698&r1=721697&r2=721698&view=diff
==============================================================================
--- 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 Sat Nov 29 10:03:29
2008
@@ -121,9 +121,8 @@
             super.dieOnCircularReference(stk, p);
         } else {
             if (tokenizer instanceof DataType) {
-                stk.push(tokenizer);
-                invokeCircularReferenceCheck((DataType) tokenizer, stk, p);
-                stk.pop();
+                pushAndInvokeCircularReferenceCheck((DataType) tokenizer, stk,
+                                                    p);
             }
             setChecked(true);
         }

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?rev=721698&r1=721697&r2=721698&view=diff
==============================================================================
--- 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
Sat Nov 29 10:03:29 2008
@@ -114,9 +114,8 @@
                 for (Iterator i = v.iterator(); i.hasNext();) {
                     Object o = i.next();
                     if (o instanceof DataType) {
-                        stk.push(o);
-                        invokeCircularReferenceCheck((DataType) o, stk, p);
-                        stk.pop();
+                        pushAndInvokeCircularReferenceCheck((DataType) o, stk,
+                                                            p);
                     }
                 }
             }

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?rev=721698&r1=721697&r2=721698&view=diff
==============================================================================
--- 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 Sat
Nov 29 10:03:29 2008
@@ -137,13 +137,9 @@
             super.dieOnCircularReference(stk, p);
         } else {
             if (control != null) {
-                stk.push(control);
-                DataType.invokeCircularReferenceCheck(control, stk, p);
-                stk.pop();
+                DataType.pushAndInvokeCircularReferenceCheck(control, stk, p);
             }
-            stk.push(comp);
-            DataType.invokeCircularReferenceCheck(comp, stk, p);
-            stk.pop();
+            DataType.pushAndInvokeCircularReferenceCheck(comp, stk, p);
             setChecked(true);
         }
     }

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?rev=721698&r1=721697&r2=721698&view=diff
==============================================================================
--- 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
Sat Nov 29 10:03:29 2008
@@ -118,9 +118,7 @@
             for (Iterator i = v.iterator(); i.hasNext();) {
                 Object o = i.next();
                 if (o instanceof DataType) {
-                    stk.push(o);
-                    invokeCircularReferenceCheck((DataType) o, stk, p);
-                    stk.pop();
+                    pushAndInvokeCircularReferenceCheck((DataType) o, stk, p);
                 }
             }
             setChecked(true);



Mime
View raw message