...
Assignments to the loop variable of an enhanced for loop (for-each idiom) fail to affect the overall iteration order or the iterated collection or array. This can lead to programmer confusion, and can leave data in a fragile or inconsistent state.
Rule | Severity | Likelihood | Detectable | RepairableRemediation Cost | Priority | Level |
|---|---|---|---|---|---|---|
DCL02-J | Low | Unlikely | Yes | NoLow | P3P2 | L3 |
Automated Detection
| Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Klocwork |
| JD.UNMOD | |||||||
| Parasoft Jtest |
| CERT.DCL02.ITMOD | Do not modify collection while iterating over it |
...