mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not replace checked exception with unchecked (IDEA-119345)
This commit is contained in:
@@ -421,8 +421,12 @@ public class ExceptionUtil {
|
||||
@Override
|
||||
public Pair<PsiMethod, PsiSubstitutor> fun(CandidateInfo info) {
|
||||
PsiElement element = info.getElement();
|
||||
return element instanceof PsiMethod && MethodSignatureUtil.areSignaturesEqual(method, (PsiMethod)element)
|
||||
? Pair.create((PsiMethod)element, info.getSubstitutor()) : null;
|
||||
if (element instanceof PsiMethod &&
|
||||
MethodSignatureUtil.areSignaturesEqual(method, (PsiMethod)element) &&
|
||||
!MethodSignatureUtil.isSuperMethod((PsiMethod)element, method)) {
|
||||
return Pair.create((PsiMethod)element, info.getSubstitutor());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
if (candidates.size() > 1) {
|
||||
@@ -456,8 +460,10 @@ public class ExceptionUtil {
|
||||
found = true;
|
||||
break;
|
||||
} else if (classType.isAssignableFrom(psiClassType)) {
|
||||
replacement.add(psiClassType);
|
||||
iterator.remove();
|
||||
if (isUncheckedException(classType) == isUncheckedException(psiClassType)) {
|
||||
replacement.add(psiClassType);
|
||||
iterator.remove();
|
||||
}
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
class SQLException extends java.lang.Exception{}
|
||||
|
||||
interface ICompileErrorTest {
|
||||
void foo() throws IllegalStateException, Exception;
|
||||
}
|
||||
|
||||
abstract class CompileErrorTest implements ICompileErrorTest {
|
||||
public void foo() throws Exception {
|
||||
throw new SQLException();
|
||||
}
|
||||
}
|
||||
|
||||
public class CompileErrorTestExtended extends CompileErrorTest {
|
||||
public void foo() throws Exception {
|
||||
try {
|
||||
super.foo();
|
||||
} catch (SQLException ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,6 +120,7 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testAssignToFinal() { doTest(false, false); }
|
||||
public void testUnhandledExceptionsInSuperclass() { doTest(false, false); }
|
||||
public void testNoUnhandledExceptionsMultipleInheritance() { doTest(false, false); }
|
||||
public void testIgnoreSuperMethodsInMultipleOverridingCheck() { doTest(false, false); }
|
||||
public void testFalseExceptionsMultipleInheritance() { doTest(true, false); }
|
||||
public void testAssignmentCompatible () { setLanguageLevel(LanguageLevel.JDK_1_5); doTest(false, false); }
|
||||
public void testMustBeBoolean() { doTest(false, false); }
|
||||
|
||||
Reference in New Issue
Block a user