Added test case for multiple violations of AssignmentToNonFinalStatic on the same variable.
Rationale: whenever this rule produces a violation, all of the unsafe assignments need to be corrected. It's annoying to fix one of these, rerun PMD and then realize there's another unsafe assignment left. Therefore, all of these violations should be reported at once.
This commit is contained in:
@ -28,6 +28,21 @@ public class Foo {
|
||||
Foo(int y) {
|
||||
x = y;
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
rule violated twice
|
||||
]]></description>
|
||||
<expected-problems>2</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
static int x;
|
||||
Foo(int y) {
|
||||
x = y;
|
||||
x = y;
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
Reference in New Issue
Block a user