mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
IDEA-62374 Suggest ternary operation to avoid NPE implemented
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace with 'list != null ?:'" "true"
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class A{
|
||||
void test(@NotNull List l) {
|
||||
final List list = null;
|
||||
test(list != null ? list : <selection>null</selection>);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace with 'integer != null ?:'" "true"
|
||||
|
||||
import java.lang.Integer;
|
||||
|
||||
class A{
|
||||
void test(){
|
||||
Integer integer = null;
|
||||
int i = integer != null ? integer.intValue() : <selection>0</selection>;
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace with 'list != null ?:'" "true"
|
||||
|
||||
class A{
|
||||
void test(){
|
||||
List list = null;
|
||||
Object o = list != null ? list.get(0) : <selection>null</selection>;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Replace with 'list != null ?:'" "false"
|
||||
class A{
|
||||
void test(){
|
||||
List list = null;
|
||||
li<caret>st.get(0);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace with 'list != null ?:'" "true"
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class A{
|
||||
void test(@NotNull List l) {
|
||||
final List list = null;
|
||||
test(li<caret>st);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace with 'integer != null ?:'" "true"
|
||||
|
||||
import java.lang.Integer;
|
||||
|
||||
class A{
|
||||
void test(){
|
||||
Integer integer = null;
|
||||
int i = in<caret>teger.intValue();
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace with 'list != null ?:'" "true"
|
||||
|
||||
class A{
|
||||
void test(){
|
||||
List list = null;
|
||||
Object o = li<caret>st.get(0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user