diff options
author | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-08 03:06:37 +0200 |
---|---|---|
committer | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-08 03:06:37 +0200 |
commit | 72194b7982ddfa8e9864d0a9934905bb76b90f33 (patch) | |
tree | ebed806c358c1a3960c5d6be4c13b26ca41809df /testing-drivers/src | |
parent | c3289ab86bfb2c97cf34147239b3dde46de92a7c (diff) | |
download | aspectj-72194b7982ddfa8e9864d0a9934905bb76b90f33.tar.gz aspectj-72194b7982ddfa8e9864d0a9934905bb76b90f33.zip |
'for' loop replaceable with enhanced 'for' loop
Reports for loops which iterate over collections or arrays, and can be replaced with an enhanced for loop (i.e. the foreach iteration syntax).
Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'testing-drivers/src')
3 files changed, 16 insertions, 16 deletions
diff --git a/testing-drivers/src/test/java/org/aspectj/testing/drivers/Harness.java b/testing-drivers/src/test/java/org/aspectj/testing/drivers/Harness.java index f1c8b3635..e932a027d 100644 --- a/testing-drivers/src/test/java/org/aspectj/testing/drivers/Harness.java +++ b/testing-drivers/src/test/java/org/aspectj/testing/drivers/Harness.java @@ -323,10 +323,10 @@ public class Harness { */ private void doEndSuite(File suiteFile, long elapsed) { Collection c = features.values(); - for (Iterator iter = c.iterator(); iter.hasNext();) { - Feature element = (Feature) iter.next(); + for (Object o : c) { + Feature element = (Feature) o; if (element.listener instanceof TestCompleteListener) { - ((TestCompleteListener)element.listener).doEndSuite(suiteFile,elapsed); + ((TestCompleteListener) element.listener).doEndSuite(suiteFile, elapsed); } } } diff --git a/testing-drivers/src/test/java/org/aspectj/testing/drivers/HarnessJUnitUtil.java b/testing-drivers/src/test/java/org/aspectj/testing/drivers/HarnessJUnitUtil.java index d3e05f84c..b26b5286f 100644 --- a/testing-drivers/src/test/java/org/aspectj/testing/drivers/HarnessJUnitUtil.java +++ b/testing-drivers/src/test/java/org/aspectj/testing/drivers/HarnessJUnitUtil.java @@ -50,12 +50,12 @@ public class HarnessJUnitUtil { if (HarnessJUnitUtil.isEmpty(options)) { options = new String[][] {new String[0]}; } - for (int i = 0; i < suites.length; i++) { - for (int j = 0; j < options.length; j++) { - Test t = AjctestsAdapter.make(suites[i], options[j]); - suite.addTest(t); - } - } + for (String s : suites) { + for (String[] option : options) { + Test t = AjctestsAdapter.make(s, option); + suite.addTest(t); + } + } } return suite; } diff --git a/testing-drivers/src/test/java/org/aspectj/testing/drivers/HarnessSelectionTest.java b/testing-drivers/src/test/java/org/aspectj/testing/drivers/HarnessSelectionTest.java index ac937ac44..a292962fc 100644 --- a/testing-drivers/src/test/java/org/aspectj/testing/drivers/HarnessSelectionTest.java +++ b/testing-drivers/src/test/java/org/aspectj/testing/drivers/HarnessSelectionTest.java @@ -87,9 +87,9 @@ public class HarnessSelectionTest extends TestCase { String[] files = new String[] { SELECT, INCREMENTAL, TITLE_LIST_ONE, TITLE_LIST_PLURAL }; - for (int i = 0; i < files.length; i++) { - assertTrue(files[i], new File(files[i]).canRead()); - } + for (String file : files) { + assertTrue(file, new File(file).canRead()); + } } public void testIncrementalSuite() { @@ -358,10 +358,10 @@ public class HarnessSelectionTest extends TestCase { assertTrue(children.length + "!= expRun=" + exp.testsRun, exp.testsRun == children.length); int actPass = 0; - for (int i = 0; i < children.length; i++) { - if (RunValidator.NORMAL.runPassed(children[i])) { - actPass++; - } + for (IRunStatus child : children) { + if (RunValidator.NORMAL.runPassed(child)) { + actPass++; + } } if (exp.passed != actPass) { assertTrue("exp.passed=" + exp.passed + " != actPass=" + actPass, false); |