mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
OptionalToIfInspection: propagate rename to nested flatMap
GitOrigin-RevId: ae65a4a91dbefc73bd160a2b92a36e296fed3c3e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
104cca28f5
commit
349d58606e
+2
-2
@@ -191,7 +191,7 @@ abstract class IntermediateOperation implements Operation {
|
||||
|
||||
static class FlatMap extends IntermediateOperation {
|
||||
|
||||
private final List<OperationRecord> myRecords;
|
||||
private List<OperationRecord> myRecords;
|
||||
private final String myVarName;
|
||||
private final FunctionHelper myFn;
|
||||
|
||||
@@ -230,7 +230,7 @@ abstract class IntermediateOperation implements Operation {
|
||||
|
||||
@Override
|
||||
public void rename(@NotNull String oldName, @NotNull ChainVariable newVar, @NotNull OptionalToIfContext context) {
|
||||
myRecords.forEach(r -> r.myOperation.rename(oldName, newVar, context));
|
||||
myRecords = ContainerUtil.map(myRecords, r -> replaceFnVariable(oldName, r, newVar, context));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+6
@@ -58,6 +58,12 @@ class Test {
|
||||
}
|
||||
}
|
||||
|
||||
void nestedFlatMapWithOuterFlatMapParam(String param0) {
|
||||
if (param0 == null) throw new NullPointerException();
|
||||
String var1 = "foo";
|
||||
String result = param0;
|
||||
}
|
||||
|
||||
void nestedOr(String param0) {
|
||||
boolean result;
|
||||
result = true;
|
||||
|
||||
+4
@@ -40,6 +40,10 @@ class Test {
|
||||
.isPresent();
|
||||
}
|
||||
|
||||
void nestedFlatMapWithOuterFlatMapParam(String param0) {
|
||||
String result = Optional.of(param0).flatMap(var0 -> Optional.of("foo").flatMap(var1 -> Optional.of(var0))).get();
|
||||
}
|
||||
|
||||
void nestedOr(String param0) {
|
||||
boolean result;
|
||||
result = Optional.of(param0)
|
||||
|
||||
Reference in New Issue
Block a user