Skip to content

Commit 2a46ff3

Browse files
authored
Merge pull request #1749 from cpovirk/noforeach
Use an indexed for loop to avoid defining an unused variable.
2 parents 5cc2cdc + 65684f6 commit 2a46ff3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/org/junit/internal/runners/ErrorReportingRunner.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ public ErrorReportingRunner(Throwable cause, Class<?>... testClasses) {
3737
@Override
3838
public Description getDescription() {
3939
Description description = Description.createSuiteDescription(classNames);
40-
for (Throwable each : causes) {
40+
/*
41+
* Use an indexed loop instead of a foreach: That avoids declaring a variable that some
42+
* tools will see as "unused."
43+
*/
44+
for (int i = 0; i < causes.size(); i++) {
4145
description.addChild(describeCause());
4246
}
4347
return description;

0 commit comments

Comments
 (0)