Browse Source

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.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1075177 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 14 years ago
parent
commit
4427f8c1ed
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      src/main/org/apache/tools/ant/Target.java

+ 3
- 2
src/main/org/apache/tools/ant/Target.java View File

@@ -383,8 +383,9 @@ public class Target implements TaskContainer {
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;


Loading…
Cancel
Save