mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-10 13:17:09 +07:00
IDEA-176397 Warn about pointless rewrapping of Optional value
Also fixed CommonDataflow: facts must be united, not intersected
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
// "Unwrap" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Tests {
|
||||
void test2(Optional<String> optional) {
|
||||
if (optional.isPresent()) {
|
||||
System.out.println(optional);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Unwrap" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Tests {
|
||||
void test3(Optional<String> optional) {
|
||||
System.out.println(Optional.of(optional.get()));
|
||||
System.out.println(optional);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Unwrap" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Tests {
|
||||
void test2(Optional<String> optional) {
|
||||
if (optional.isPresent()) {
|
||||
System.out.println(Optional.o<caret>f(optional.get()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Unwrap" "false"
|
||||
import java.util.*;
|
||||
|
||||
public class Tests {
|
||||
void test3(Optional<String> optional) {
|
||||
System.out.println(Optional.o<caret>f(optional.get()));
|
||||
System.out.println(Optional.of(optional.get()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Unwrap" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Tests {
|
||||
void test3(Optional<String> optional) {
|
||||
System.out.println(Optional.of(optional.get()));
|
||||
System.out.println(Optional.o<caret>f(optional.get()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Unwrap" "false"
|
||||
import java.util.*;
|
||||
|
||||
public class Tests {
|
||||
void test(Optional<String> optional, boolean b) {
|
||||
if (b || optional.isPresent()) {
|
||||
System.out.println(Optional.o<caret>f(optional.get()));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user