From 4a8c23472c0e3eb9df0e161890abccc89a0e8524 Mon Sep 17 00:00:00 2001 From: Maikel Steneker Date: Wed, 17 Apr 2019 15:17:03 +0200 Subject: [PATCH] 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. --- .../errorprone/xml/AssignmentToNonFinalStatic.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AssignmentToNonFinalStatic.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AssignmentToNonFinalStatic.xml index 7f4c7844d1..249aeb6839 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AssignmentToNonFinalStatic.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AssignmentToNonFinalStatic.xml @@ -28,6 +28,21 @@ public class Foo { Foo(int y) { x = y; } +} + ]]> + + + + 2 +