mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
disable add catch exception for method references (IDEA-205952)
This commit is contained in:
+1
-1
@@ -130,7 +130,7 @@ public class AddExceptionToExistingCatchFix extends PsiElementBaseIntentionActio
|
||||
|
||||
@Nullable
|
||||
static Context from(@NotNull PsiElement element) {
|
||||
if (!element.isValid() || !PsiUtil.isLanguageLevel7OrHigher(element)) return null;
|
||||
if (!element.isValid() || !PsiUtil.isLanguageLevel7OrHigher(element) || element instanceof PsiMethodReferenceExpression) return null;
|
||||
List<PsiClassType> unhandledExceptions = new ArrayList<>(ExceptionUtil.getOwnUnhandledExceptions(element));
|
||||
if (unhandledExceptions.isEmpty()) return null;
|
||||
List<PsiTryStatement> tryStatements = getTryStatements(element);
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// "Add exception to existing catch clause" "false"
|
||||
import java.util.*;
|
||||
|
||||
class MyTest {
|
||||
|
||||
void demo(List<String> strings) {
|
||||
try {
|
||||
strings.forEach(this::f<caret>oo);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
// handle
|
||||
}
|
||||
}
|
||||
|
||||
private void foo(String s) throws Exception {
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user