File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
java-checks/src/main/java/org/sonar/java/checks
java-frontend/src/test/java/org/sonar/java/classpath Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 2020import java .util .List ;
2121import javax .annotation .CheckForNull ;
2222import javax .annotation .Nullable ;
23- import org .apache .commons .lang3 .ArrayUtils ;
2423import org .sonar .check .Rule ;
2524import org .sonar .plugins .java .api .JavaVersionAwareVisitor ;
2625import org .sonar .java .ast .visitors .SubscriptionVisitor ;
@@ -61,7 +60,15 @@ public class DiamondOperatorCheck extends SubscriptionVisitor implements JavaVer
6160 Tree .Kind .RETURN_STATEMENT ,
6261 Tree .Kind .ASSIGNMENT
6362 };
64- private static final Tree .Kind [] JAVA_8_KINDS = ArrayUtils .add (JAVA_7_KINDS , Tree .Kind .CONDITIONAL_EXPRESSION );
63+
64+ private static final Tree .Kind [] JAVA_8_KINDS = new Tree .Kind [] {
65+ Tree .Kind .VARIABLE ,
66+ Tree .Kind .TYPE_CAST ,
67+ Tree .Kind .RETURN_STATEMENT ,
68+ Tree .Kind .ASSIGNMENT ,
69+ Tree .Kind .CONDITIONAL_EXPRESSION
70+ };
71+
6572 private Tree .Kind [] expressionKindsToCheck = JAVA_7_KINDS ;
6673
6774 @ Override
Original file line number Diff line number Diff line change 1818
1919import java .io .File ;
2020import java .util .List ;
21- import org .apache .commons .lang3 .ArrayUtils ;
2221import org .junit .jupiter .api .BeforeEach ;
2322import org .junit .jupiter .api .Test ;
2423import org .junit .jupiter .api .extension .RegisterExtension ;
@@ -70,7 +69,7 @@ void setup() {
7069 public String [] getStringArray (String key ) {
7170 return get (key )
7271 .map (v -> MultivalueProperty .parseAsCsv (key , v ))
73- .orElse (ArrayUtils . EMPTY_STRING_ARRAY );
72+ .orElse (new String [ 0 ] );
7473 }
7574 };
7675 analysisWarnings = mock (AnalysisWarningsWrapper .class );
You can’t perform that action at this time.
0 commit comments