...
Name reuse makes code more difficult to read and maintain, which can result in security weaknesses. An automated tool can easily detect reuse of identifiers in containing scopes.
Automated Detection
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
Parasoft Jtest |
| CERT.DCL51.HMF | Do not give method local variables and parameters the same name as class fields | ||||||
SonarQube |
| HiddenFieldCheck |
...
Bibliography
Puzzle 67, "All Strung Out" | |
Item 16, "Prefer Interfaces to Abstract Classes" | |
§6.3, "Placement" | |
[JLS 2013] | §6.4.1, "Shadowing" |
...
...