final List<PsiClassType> thrownTypes = ExceptionUtil.collectSubstituted(collisionResolvedSubstitutor, sourceMethod.getThrowsList().getReferencedTypes(),
scope);
if (target instanceof PsiClass) {
- final PsiClass[] supers = ((PsiClass)target).getSupers();
- for (PsiClass aSuper : supers) {
- final PsiMethod psiMethod = aSuper.findMethodBySignature(sourceMethod, true);
+ final PsiMethod[] methods = ((PsiClass)target).findMethodsBySignature(sourceMethod, true);
+ for (PsiMethod psiMethod : methods) {
if (psiMethod != null && psiMethod != sourceMethod) {
- PsiSubstitutor superClassSubstitutor = TypeConversionUtil.getSuperClassSubstitutor(aSuper, (PsiClass)target, PsiSubstitutor.EMPTY);
- ExceptionUtil.retainExceptions(thrownTypes, ExceptionUtil.collectSubstituted(superClassSubstitutor, psiMethod.getThrowsList().getReferencedTypes(), scope));
+ PsiClass aSuper = psiMethod.getContainingClass();
+ if (aSuper != null && aSuper != target) {
+ PsiSubstitutor superClassSubstitutor = TypeConversionUtil.getSuperClassSubstitutor(aSuper, (PsiClass)target, PsiSubstitutor.EMPTY);
+ ExceptionUtil.retainExceptions(thrownTypes, ExceptionUtil.collectSubstituted(superClassSubstitutor, psiMethod.getThrowsList().getReferencedTypes(), scope));
+ }
}
}
}
--- /dev/null
+interface A {
+ void a() throws java.io.IOException;
+}
+
+interface B {
+ void a() throws InstantiationException;
+}
+
+interface C extends A, B {}
+
+class D implements C {
+ @Override
+ public void a() {
+
+ }
+}
\ No newline at end of file
--- /dev/null
+interface A {
+ void a() throws java.io.IOException;
+}
+
+interface B {
+ void a() throws InstantiationException;
+}
+
+interface C extends A, B {}
+
+class D implements C {
+ <caret>
+}
\ No newline at end of file
public void testSkipUnknownAnnotations() { doTest(true) }
public void testMultipleInheritedThrows() { doTest(false) }
public void testOverrideInInterface() { doTest(false) }
+ public void testMultipleInheritanceWithThrowables() { doTest(true) }
public void testImplementInInterface() {
myFixture.addClass """\