[java-inspections] TrivialFunctionalExpressionUsageInspection: solve naming conflicts instead of keeping the block

Keeping the block does not work correctly for blocks with return statement

GitOrigin-RevId: d14e22e793840d74957928a8d7748275db4929ef
This commit is contained in:
Tagir Valeev
2023-04-24 11:37:56 +02:00
committed by intellij-monorepo-bot
parent e536db53dc
commit 4c29ff02f6
4 changed files with 44 additions and 18 deletions

View File

@@ -38,4 +38,15 @@ class X {
}
}
}
private static List<String> getStrings(List<String> test) {
ArrayList<String> objects1 = new ArrayList<>();
objects1.add("1");
ArrayList<String> strings = objects1;
for (String string : test) {
System.out.println("1");
strings.add(string);
}
return strings;
}
}

View File

@@ -37,4 +37,16 @@ class X {
})
.collect(Collectors.toList());
}
private static List<String> getStrings(List<String> test) {
return test.stream()
.collect(()->{
ArrayList<String> objects = new ArrayList<>();
objects.add("1");
return objects;
}, (strings, string) -> {
System.out.println("1");
strings.add(string);
}, (strings, strings2) -> strings.addAll(strings2));
}
}