mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 00:11:26 +07:00
IDEA-138553 Inspection for usages of Optinoal.ofNullable() for values known to be null or non-null
This commit is contained in:
+6
@@ -0,0 +1,6 @@
|
||||
// "Replace with '.of()'" "true"
|
||||
class A{
|
||||
void test(){
|
||||
com.google.common.base.Optional.of(1<caret>1);
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Replace with '.absent()'" "true"
|
||||
class A{
|
||||
void test(){
|
||||
com.google.common.base.Optional.absent(<caret>);
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Replace with '.of()'" "true"
|
||||
class A{
|
||||
void test(){
|
||||
java.util.Optional.of(1<caret>1);
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace with '.of()'" "true"
|
||||
|
||||
class A{
|
||||
void test(String s){
|
||||
assert s != null;
|
||||
java.util.Optional.of(<caret>s);
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Replace with '.empty()'" "true"
|
||||
class A {
|
||||
void test() {
|
||||
String s = null;
|
||||
java.util.Optional.empty(<caret>);
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Replace with '.empty()'" "true"
|
||||
class A {
|
||||
void test() {
|
||||
String s = null;
|
||||
java.util.Optional.empty(<caret>);
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Replace with '.of()'" "true"
|
||||
class A{
|
||||
void test(){
|
||||
com.google.common.base.Optional.fromNullable(1<caret>1);
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Replace with '.absent()'" "true"
|
||||
class A{
|
||||
void test(){
|
||||
com.google.common.base.Optional.fromNullable(n<caret>ull);
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Replace with '.of()'" "true"
|
||||
class A{
|
||||
void test(){
|
||||
java.util.Optional.ofNullable(1<caret>1);
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace with '.of()'" "true"
|
||||
|
||||
class A{
|
||||
void test(String s){
|
||||
assert s != null;
|
||||
java.util.Optional.ofNullable(<caret>s);
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Replace with '.empty()'" "true"
|
||||
class A {
|
||||
void test() {
|
||||
String s = null;
|
||||
java.util.Optional.ofNullable(n<caret>ull);
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Replace with '.empty()'" "true"
|
||||
class A {
|
||||
void test() {
|
||||
String s = null;
|
||||
java.util.Optional.ofNullable(<caret>s);
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Replace with '.of()'" "false"
|
||||
class A{
|
||||
void test(String s){
|
||||
java.util.Optional.ofNullable(<caret>s);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user