aboutsummaryrefslogtreecommitdiffstats
path: root/taskdefs
diff options
context:
space:
mode:
authorLars Grefer <eclipse@larsgrefer.de>2020-08-08 03:09:01 +0200
committerLars Grefer <eclipse@larsgrefer.de>2020-08-08 03:09:01 +0200
commita508fd5315c6330f2057c219aebc35b15d0ea497 (patch)
treec0ec3cef4e3411f22e5124ae36eba542a35a495a /taskdefs
parent72194b7982ddfa8e9864d0a9934905bb76b90f33 (diff)
downloadaspectj-a508fd5315c6330f2057c219aebc35b15d0ea497.tar.gz
aspectj-a508fd5315c6330f2057c219aebc35b15d0ea497.zip
'while' loop replaceable with enhanced 'for' loop
Reports while loops which iterate over collections, and can be replaced with an enhanced for loop (i.e. foreach iteration syntax). Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'taskdefs')
-rw-r--r--taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc2.java16
1 files changed, 7 insertions, 9 deletions
diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc2.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc2.java
index a089f00b9..9aea9ae6d 100644
--- a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc2.java
+++ b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc2.java
@@ -416,11 +416,10 @@ public class Ajc2 extends Javac {
List newIncludes = new ArrayList();
List newArguments = new ArrayList();
if (argfiles != null) {
- Iterator iter = argfiles.iterator();
- while (iter.hasNext()) {
- File argfile = ((Argfile)iter.next()).getFile();
- expandArgfile(argfile, newIncludes, newArguments);
- }
+ for (Object o : argfiles) {
+ File argfile = ((Argfile) o).getFile();
+ expandArgfile(argfile, newIncludes, newArguments);
+ }
}
// If there aren't any includes, but we've used an argfile then we should
@@ -445,10 +444,9 @@ public class Ajc2 extends Javac {
}
// Add the new included files
- Iterator iter = newIncludes.iterator();
- while (iter.hasNext()) {
- newFiles.add((File)iter.next());
- }
+ for (Object newInclude : newIncludes) {
+ newFiles.add((File) newInclude);
+ }
// This is the same behavior found in Javac
int newFileSize = newFiles.size();