OptionalToIfInspection: added inspection to desugar optional chain to sequence of if statements (IDEA-212269)

GitOrigin-RevId: c83b70e05544529b3dfffe24bc87997910edcb56
This commit is contained in:
Artemiy Sartakov
2019-08-07 17:02:43 +03:00
committed by intellij-monorepo-bot
parent 987f5c84d3
commit 6f1efb8fc0
51 changed files with 2953 additions and 553 deletions
@@ -0,0 +1,17 @@
// "Fix all 'Optional can be replaced with sequence of if statements' problems in file" "true"
class Test {
void simple(String in) {
Optional.ofNullable<caret>(in).ifPresent(System.out::println);
}
void lambdaIsNotSimplified(String in, String p1, String p2) {
if (in == null || p1 == null) throw new IllegalArgumentException();
Optional.ofNullable(in).ifPresent(s -> {
String tmp = "foo";
tmp = "bar";
});
}
}