24 lines
663 B
Plaintext
24 lines
663 B
Plaintext
:message: Rename "${elementName}" which (hides|has the same name as) the field declared at line {}.
|
|
|
|
include::../why.adoc[]
|
|
|
|
[source,java]
|
|
----
|
|
class Foo {
|
|
public int myField;
|
|
|
|
public void doSomething() {
|
|
int myField = 0; // Noncompliant
|
|
...
|
|
}
|
|
}
|
|
----
|
|
|
|
== Resources
|
|
|
|
=== Documentation
|
|
|
|
* https://wiki.sei.cmu.edu/confluence/display/c/DCL01-C.+Do+not+reuse+variable+names+in+subscopes[CERT, DCL01-C.] - Do not reuse variable names in subscopes
|
|
* https://wiki.sei.cmu.edu/confluence/display/java/DCL51-J.+Do+not+shadow+or+obscure+identifiers+in+subscopes[CERT, DCL51-J.] - Do not shadow or obscure identifiers in subscopes
|
|
|
|
include::../rspecator.adoc[] |