ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r1075177 - /ant/core/trunk/src/main/org/apache/tools/ant/Target.java
Date Sun, 27 Feb 2011 23:13:30 GMT
Author: antoine
Date: Sun Feb 27 23:13:30 2011
New Revision: 1075177

URL: http://svn.apache.org/viewvc?rev=1075177&view=rev
Log:
PR 50716. Here is a case where optimizing a loop by using a variable for the upper bound of
the loop breaks an existing test case RhinoTest.

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/Target.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/Target.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/Target.java?rev=1075177&r1=1075176&r2=1075177&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/Target.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/Target.java Sun Feb 27 23:13:30 2011
@@ -383,8 +383,9 @@ public class Target implements TaskConta
         try {
             // use index-based approach to avoid ConcurrentModificationExceptions;
             // also account for growing target children
-            final int size = children.size();
-            for (int i = 0; i < size; i++) {
+        	// do not optimize this loop by replacing children.size() by a variable
+        	// as children can be added dynamically as in RhinoScriptTest where a target is
adding work for itself
+            for (int i = 0; i < children.size(); i++) {
                 Object o = children.get(i);
                 if (o instanceof Task) {
                     Task task = (Task) o;



Mime
View raw message