Unverified Commit c9540176 authored by Martin Monperrus's avatar Martin Monperrus Committed by GitHub
Browse files

Update VisitorPartialEvaluator.java

parent 0bb27f23
...@@ -47,6 +47,7 @@ import spoon.reflect.reference.CtTypeReference; ...@@ -47,6 +47,7 @@ import spoon.reflect.reference.CtTypeReference;
import spoon.reflect.visitor.CtScanner; import spoon.reflect.visitor.CtScanner;
import spoon.support.util.RtHelper; import spoon.support.util.RtHelper;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -332,7 +333,7 @@ public class VisitorPartialEvaluator extends CtScanner implements PartialEvaluat ...@@ -332,7 +333,7 @@ public class VisitorPartialEvaluator extends CtScanner implements PartialEvaluat
// Evaluate forInit // Evaluate forInit
List<CtStatement> lst = forLoop.getForInit(); List<CtStatement> lst = forLoop.getForInit();
for (CtStatement s : lst) { for (CtStatement s : new ArrayList<>(lst)) { // copying the list to avoid ConcurrentModificationException
CtStatement evaluateStatement = evaluate(s); CtStatement evaluateStatement = evaluate(s);
if (evaluateStatement != null) { if (evaluateStatement != null) {
forLoop.addForInit(evaluateStatement); forLoop.addForInit(evaluateStatement);
...@@ -344,7 +345,7 @@ public class VisitorPartialEvaluator extends CtScanner implements PartialEvaluat ...@@ -344,7 +345,7 @@ public class VisitorPartialEvaluator extends CtScanner implements PartialEvaluat
// Evaluate forUpdate // Evaluate forUpdate
lst = forLoop.getForUpdate(); lst = forLoop.getForUpdate();
for (CtStatement s : lst) { for (CtStatement s : new ArrayList<>(lst)) { // copying the list to avoid ConcurrentModificationException
CtStatement evaluateStatement = evaluate(s); CtStatement evaluateStatement = evaluate(s);
if (evaluateStatement != null) { if (evaluateStatement != null) {
forLoop.addForUpdate(evaluateStatement); forLoop.addForUpdate(evaluateStatement);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment