mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
stream migration: do not suggest to migrate if exceptions are thrown inside the block (IDEA-129484)
This commit is contained in:
+1
-1
@@ -111,7 +111,7 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
|
||||
}
|
||||
});
|
||||
|
||||
if (effectivelyFinal[0]) {
|
||||
if (effectivelyFinal[0] && ExceptionUtil.getThrownCheckedExceptions(new PsiElement[] {body}).isEmpty()) {
|
||||
if (isCollectCall(body)) {
|
||||
holder.registerProblem(iteratedValue, "Can be replaced with collect call",
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new ReplaceWithCollectCallFix());
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Replace with collect" "false"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
public void foo() throws Exception {}
|
||||
|
||||
public static void bar(List<Test> currentImportLine) throws Exception {
|
||||
for (Test test : currentImp<caret>ortLine) {
|
||||
if (true) {
|
||||
test.foo();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user