mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-26 19:06:24 +07:00
Migrate to simplified collection: disable if null or repeating constant value; checkbox to not warn on non-constant content
This commit is contained in:
@@ -4,5 +4,5 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
public static final List<Number> EVEN = List.of(2, 4, 6, 8, 10);
|
||||
public static final List<Number> EVEN = List.of(2, 4, 6, 8, 10, 2);
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class Test {
|
||||
public static final Set<String> MY_SET = Set.of("a", "b", "c");
|
||||
public static final Set<String> MY_SET = Set.of("a", "b", "c", Math.random() > 0.5 ? "d" : Math.random() > 0.5 ? "e" : "d");
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace with 'Set.of' call" "false"
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class Test {
|
||||
static final String CONST = "b";
|
||||
|
||||
public static final Set<String> MY_SET = Set.of("a", "b", "c", CONST);
|
||||
}
|
||||
@@ -4,5 +4,5 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
public static final List<Number> EVEN = Collections.unmodi<caret>fiableList(Arrays.asList(2,4,6,8,10));
|
||||
public static final List<Number> EVEN = Collections.unmodi<caret>fiableList(Arrays.asList(2,4,6,8,10,2));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Replace with 'List.of' call" "false"
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
public static final List<Number> EVEN = Collections.unmodi<caret>fiableList(Arrays.asList(2,4,6,8,10,Math.random() > 0.5 ? 12 : null));
|
||||
}
|
||||
@@ -5,5 +5,5 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class Test {
|
||||
public static final Set<String> MY_SET = Collections.unm<caret>odifiableSet(new HashSet<>(Arrays.asList("a", "b", "c")));
|
||||
public static final Set<String> MY_SET = Collections.unm<caret>odifiableSet(new HashSet<>(Arrays.asList("a", "b", "c", Math.random() > 0.5 ? "d" : Math.random() > 0.5 ? "e" : "d")));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user