File tree Expand file tree Collapse file tree
main/java/org/sonar/java/checks Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323import org .sonar .check .Priority ;
2424import org .sonar .check .Rule ;
2525import org .sonar .check .RuleProperty ;
26- import org .sonar .java .model .ModifiersUtils ;
2726import org .sonar .java .tag .Tag ;
2827import org .sonar .plugins .java .api .JavaFileScanner ;
2928import org .sonar .plugins .java .api .JavaFileScannerContext ;
3231import org .sonar .plugins .java .api .tree .EnumConstantTree ;
3332import org .sonar .plugins .java .api .tree .ExpressionTree ;
3433import org .sonar .plugins .java .api .tree .LiteralTree ;
35- import org .sonar .plugins .java .api .tree .Modifier ;
3634import org .sonar .plugins .java .api .tree .NewArrayTree ;
3735import org .sonar .plugins .java .api .tree .Tree ;
3836import org .sonar .plugins .java .api .tree .Tree .Kind ;
@@ -122,7 +120,7 @@ public void visitAnnotation(AnnotationTree annotationTree) {
122120 public void visitVariable (VariableTree tree ) {
123121 ExpressionTree initializer = tree .initializer ();
124122 boolean arrayNotInitialized = initializer != null && initializer .is (Kind .NEW_ARRAY ) && ((NewArrayTree ) initializer ).initializers ().isEmpty ();
125- if (arrayNotInitialized || !ModifiersUtils . hasModifier ( tree .modifiers (), Modifier . FINAL )) {
123+ if (arrayNotInitialized || !tree .symbol (). isFinal ( )) {
126124 super .visitVariable (tree );
127125 }
128126 }
Original file line number Diff line number Diff line change @@ -80,3 +80,7 @@ protected char[] initialValue() {
8080
8181 int nothing ;
8282}
83+
84+ interface I {
85+ int VALUE = 42 ; // Compliant
86+ }
You can’t perform that action at this time.
0 commit comments