mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-17 21:43:33 +07:00
Cleanup: NotNull/Nullable
GitOrigin-RevId: b8e892f32ea84c2115973155dba7127b892cc36e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
18962d3d42
commit
c1813cfb52
-8
@@ -1,8 +0,0 @@
|
||||
// "Assert 'obj instanceof String'" "true"
|
||||
class X {
|
||||
void test(Object obj) {
|
||||
if (obj instanceof Integer) System.out.println();
|
||||
assert obj instanceof String;
|
||||
String string = (String)obj;
|
||||
}
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
// "Assert 'obj instanceof String'" "true"
|
||||
class X {
|
||||
void test(Object obj) {
|
||||
if (obj instanceof Integer) System.out.println();
|
||||
String string = (<caret>String)obj;
|
||||
}
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
// "Collapse repeating annotations" "true"
|
||||
|
||||
@SuppressWarnings({"foo", "bar", "baz"})
|
||||
class X{}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
// "Collapse repeating annotations" "true"
|
||||
|
||||
@XYZ(data = {1, 2, 3, 4})
|
||||
@XYZ(5)
|
||||
class X{}
|
||||
@interface XYZ {
|
||||
int value() default 0;
|
||||
|
||||
int[] data();
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
// "Collapse repeating annotations" "true"
|
||||
|
||||
@SuppressWarnings({"foo", "bar", "baz"})
|
||||
class X{}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
// "Collapse repeating annotations" "true"
|
||||
|
||||
@SuppressWarnings({"foo", "bar"})
|
||||
class X{}
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
// "Collapse repeating annotations" "true"
|
||||
|
||||
@SuppressWarnings({"foo", "bar"})
|
||||
@<caret>SuppressWarnings("baz")
|
||||
class X{}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
// "Collapse repeating annotations" "true"
|
||||
|
||||
@X<caret>YZ(data = 1)
|
||||
@XYZ(data = {2, 3})
|
||||
@XYZ(data = {4})
|
||||
@XYZ(5)
|
||||
class X{}
|
||||
@interface XYZ {
|
||||
int value() default 0;
|
||||
|
||||
int[] data();
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
// "Collapse repeating annotations" "true"
|
||||
|
||||
@<caret>SuppressWarnings("foo")
|
||||
@SuppressWarnings("bar")
|
||||
@SuppressWarnings("baz")
|
||||
class X{}
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
// "Collapse repeating annotations" "true"
|
||||
|
||||
@<caret>SuppressWarnings("foo")
|
||||
@SuppressWarnings("bar")
|
||||
class X{}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
// "Create local variable 'inner'" "true"
|
||||
class OuterGeneric<T> {
|
||||
class Inner {
|
||||
}
|
||||
static OuterGeneric<Object>.Inner create() {
|
||||
return null;
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
OuterGeneric.Inner inner = create();
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
// "Create local variable 'inner'" "true"
|
||||
class OuterGeneric<T> {
|
||||
class Inner {
|
||||
}
|
||||
static OuterGeneric<Object>.Inner create() {
|
||||
return null;
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
i<caret>nner = create();
|
||||
}
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
// "Create type parameter 'T'" "false"
|
||||
|
||||
class Test {
|
||||
@<caret>T
|
||||
void foo() {}
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
// "Replace explicit type with 'var'" "true"
|
||||
class MyTest {
|
||||
private void m() {
|
||||
var r = new Runnable() {
|
||||
@Override
|
||||
public void run() {}
|
||||
};
|
||||
}
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
// "Replace explicit type with 'var'" "true"
|
||||
class MyTest {
|
||||
private void m() {
|
||||
Ru<caret>nnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {}
|
||||
};
|
||||
}
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
// "Make 'b' return 'java.lang.Integer'" "true"
|
||||
|
||||
class MyClass {
|
||||
interface BaseInterface {
|
||||
|
||||
Object b();
|
||||
}
|
||||
|
||||
class BooleanImpl implements BaseInterface {
|
||||
|
||||
@Override
|
||||
public Boolean b() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class IntegerImpl implements BaseInterface {
|
||||
|
||||
@Override
|
||||
public Integer b() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
// "Make 'b' return 'java.lang.Integer'" "true"
|
||||
|
||||
class MyClass {
|
||||
interface BaseInterface {
|
||||
|
||||
Object b();
|
||||
}
|
||||
|
||||
class BooleanImpl implements BaseInterface {
|
||||
|
||||
@Override
|
||||
public Boolean b() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class IntegerImpl implements BaseInterface {
|
||||
|
||||
@Override
|
||||
public String b() {
|
||||
return <caret>1;
|
||||
}
|
||||
}
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
// "Add method body" "true"
|
||||
|
||||
interface Some {
|
||||
public static void m() {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
// "Make 'm' not default" "true"
|
||||
|
||||
class Some {
|
||||
public void <caret>m() {
|
||||
}
|
||||
}
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
// "Add method body" "true"
|
||||
|
||||
interface Some {
|
||||
public static void <caret>m();
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
// "Delete method body" "false"
|
||||
|
||||
class Some {
|
||||
public default void <caret>m() {
|
||||
}
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
// "Make 'm' not default" "true"
|
||||
|
||||
class Some {
|
||||
public default void <caret>m() {
|
||||
}
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
// "Replace Optional.isPresent() condition with functional style expression" "false"
|
||||
import java.util.Optional;
|
||||
|
||||
class Test {
|
||||
Object get() {
|
||||
Optional<String> obj = Stream.of("one", "two").filter(s -> Math.sqrt(s.length()) > 100).findFirst();
|
||||
if (obj.<caret>isPresent()) {
|
||||
return obj.get();
|
||||
} else {
|
||||
return 7;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
// "Simplify boolean expression" "true"
|
||||
class X {
|
||||
|
||||
void test(int a, int b) {
|
||||
if (a + 1 + foo(a, b) > 5) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int foo(int a, int b) {
|
||||
return a+b;
|
||||
}
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
// "Simplify boolean expression" "true"
|
||||
class X {
|
||||
|
||||
void test(int a, int b) {
|
||||
if (<caret>true && (a + 1) + foo((a), b) > 5) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int foo(int a, int b) {
|
||||
return a+b;
|
||||
}
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
// "Sort content" "true"
|
||||
|
||||
enum Colors {
|
||||
CLUBS,
|
||||
DIAMOND,
|
||||
HEARTS,
|
||||
SPADES
|
||||
|
||||
|
||||
public enum Direction {
|
||||
UP, DOWN
|
||||
}
|
||||
|
||||
//1
|
||||
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
// "Sort content" "true"
|
||||
|
||||
enum Colors {
|
||||
SPADES,
|
||||
DIAMOND,
|
||||
HEARTS,
|
||||
CLU<caret>BS
|
||||
|
||||
public enum Direction {
|
||||
UP,DOWN
|
||||
}
|
||||
|
||||
//1
|
||||
|
||||
}
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
// "Replace Stream API chain with loop" "true"
|
||||
|
||||
import java.util.StringJoiner;
|
||||
import java.util.stream.*;
|
||||
|
||||
public class Test {
|
||||
private static final String ARRAY_ELEMENT_SEPARATOR = ", ", ARRAY_START = "[", ARRAY_END = "]";
|
||||
|
||||
public static String nullSafeToString(byte[] array) {
|
||||
StringJoiner joiner = new StringJoiner(ARRAY_ELEMENT_SEPARATOR, ARRAY_START, ARRAY_END);
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
String s = String.valueOf(array[i]);
|
||||
joiner.add(s);
|
||||
}
|
||||
return joiner.toString();
|
||||
}
|
||||
}
|
||||
-10
@@ -43,14 +43,4 @@ public class Main {
|
||||
|
||||
interface Visitor { }
|
||||
}
|
||||
|
||||
class X implements Iterable<String> {
|
||||
class Y {
|
||||
void test() {
|
||||
for (String s : X.this) {
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-11
@@ -31,15 +31,4 @@ public class Main {
|
||||
}
|
||||
}
|
||||
|
||||
class X implements Map<String, String> {
|
||||
class Y {
|
||||
void test() {
|
||||
for (Entry<String, String> entry : X.this.entrySet()) {
|
||||
String k = entry.getKey();
|
||||
String v = entry.getValue();
|
||||
System.out.println(k + "-" + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
// "Replace Stream API chain with loop" "true"
|
||||
|
||||
import java.util.stream.*;
|
||||
|
||||
public class Test {
|
||||
private static final String ARRAY_ELEMENT_SEPARATOR = ", ", ARRAY_START = "[", ARRAY_END = "]";
|
||||
|
||||
public static String nullSafeToString(byte[] array) {
|
||||
return IntStream.range(0, array.length).mapToObj(i -> String.valueOf(array[i]))
|
||||
.collec<caret>t(Collectors.joining(ARRAY_ELEMENT_SEPARATOR, ARRAY_START, ARRAY_END));
|
||||
}
|
||||
}
|
||||
-8
@@ -33,12 +33,4 @@ public class Main {
|
||||
|
||||
interface Visitor { }
|
||||
}
|
||||
|
||||
class X implements Iterable<String> {
|
||||
class Y {
|
||||
void test() {
|
||||
forEach(System.out::println);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-7
@@ -21,11 +21,4 @@ public class Main {
|
||||
map.forEach(otherMap::putIfAbsent);
|
||||
}
|
||||
|
||||
class X implements Map<String, String> {
|
||||
class Y {
|
||||
void test() {
|
||||
forEach((k, v) -> System.out.println(k + "-" + v));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
// "Surround with 'if (obj instanceof String)'" "true"
|
||||
class X {
|
||||
void test(Object obj) {
|
||||
if (obj instanceof Integer) System.out.println();
|
||||
if (obj instanceof String) {
|
||||
String string = (String)obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
// "Surround with 'if (obj instanceof String)'" "true"
|
||||
class X {
|
||||
void test(Object obj) {
|
||||
if (obj instanceof Integer) System.out.println();
|
||||
String string = (<caret>String)obj;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user