Skip to content

Commit

Permalink
Merge pull request #1749 from cpovirk/noforeach
Browse files Browse the repository at this point in the history
Use an indexed for loop to avoid defining an unused variable.
  • Loading branch information
kcooney authored Nov 23, 2022
2 parents 5cc2cdc + 65684f6 commit 2a46ff3
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ public ErrorReportingRunner(Throwable cause, Class<?>... testClasses) {
@Override
public Description getDescription() {
Description description = Description.createSuiteDescription(classNames);
for (Throwable each : causes) {
/*
* Use an indexed loop instead of a foreach: That avoids declaring a variable that some
* tools will see as "unused."
*/
for (int i = 0; i < causes.size(); i++) {
description.addChild(describeCause());
}
return description;
Expand Down

0 comments on commit 2a46ff3

Please sign in to comment.