OptionalToIfInspection: misc fixes

1. generate if with curly braces when it contains single declaration inside
2. restore else branch after generating code for flatMap
3. do not reassign source variable for nested source operations

GitOrigin-RevId: 061fbcc8d8dda586dcecb9a448752709a43370da
This commit is contained in:
Artemiy Sartakov
2020-04-21 08:55:39 +00:00
committed by intellij-monorepo-bot
parent 05017ec31f
commit f0c78aea15
6 changed files with 37 additions and 4 deletions
@@ -50,6 +50,20 @@ class Test {
}
}
void nestedFlatMap(String var0) {
boolean b = false;
if (var0 != null) {
String var2 = var0.toLowerCase();
b = true;
}
}
String flatMapWithOrInside() {
Object o1 = null;
String empty = null;
throw new NoSuchElementException("No value present");
}
<T> T id(T t) {
return t;
}