diff --git a/java/java-analysis-impl/src/com/intellij/psi/impl/FindSuperElementsHelper.java b/java/java-analysis-impl/src/com/intellij/psi/impl/FindSuperElementsHelper.java index aabcce64630c..871c816acda3 100644 --- a/java/java-analysis-impl/src/com/intellij/psi/impl/FindSuperElementsHelper.java +++ b/java/java-analysis-impl/src/com/intellij/psi/impl/FindSuperElementsHelper.java @@ -174,9 +174,9 @@ public class FindSuperElementsHelper { // calculate substitutor of containingClass --> inheritor PsiSubstitutor substitutor = TypeConversionUtil.getSuperClassSubstitutor(myContainingClass, inheritor, PsiSubstitutor.EMPTY); // calculate substitutor of inheritor --> superInterface - substitutor = TypeConversionUtil.getSuperClassSubstitutor(superInterface, inheritor, substitutor); + PsiSubstitutor superInterfaceSubstitutor = TypeConversionUtil.getSuperClassSubstitutor(superInterface, inheritor, substitutor); - return MethodSignatureUtil.isSubsignature(superMethod.getSignature(substitutor), method.getSignature(PsiSubstitutor.EMPTY)); + return MethodSignatureUtil.isSubsignature(superMethod.getSignature(superInterfaceSubstitutor), method.getSignature(substitutor)); } Map getResult() { diff --git a/java/java-tests/testData/codeInsight/gotosuper/SiblingInheritanceAndGenerics.after.java b/java/java-tests/testData/codeInsight/gotosuper/SiblingInheritanceAndGenerics.after.java new file mode 100644 index 000000000000..5cb44b445d07 --- /dev/null +++ b/java/java-tests/testData/codeInsight/gotosuper/SiblingInheritanceAndGenerics.after.java @@ -0,0 +1,18 @@ +package x; + +class Data { +} + +abstract class Abstract { + public String foo(T data) { + return "foo"; + } +} + +interface Interface { + public String foo(T data); +} + +class Implementation extends Abstract implements Interface { + +} diff --git a/java/java-tests/testData/codeInsight/gotosuper/SiblingInheritanceAndGenerics.java b/java/java-tests/testData/codeInsight/gotosuper/SiblingInheritanceAndGenerics.java new file mode 100644 index 000000000000..adee5ecd2202 --- /dev/null +++ b/java/java-tests/testData/codeInsight/gotosuper/SiblingInheritanceAndGenerics.java @@ -0,0 +1,18 @@ +package x; + +class Data { +} + +abstract class Abstract { + public String foo(T data) { + return "foo"; + } +} + +interface Interface { + public String foo(T data); +} + +class Implementation extends Abstract implements Interface { + +} diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/JavaGotoSuperTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/JavaGotoSuperTest.java index 93cf74193d38..cd5212eb9179 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/JavaGotoSuperTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/JavaGotoSuperTest.java @@ -115,6 +115,16 @@ public class JavaGotoSuperTest extends LightDaemonAnalyzerTestCase { checkResultByFile(getBasePath() + "SiblingInheritance.java"); } + public void testSiblingInheritanceAndGenerics() throws Throwable { + configureByFile(getBasePath() + "SiblingInheritanceAndGenerics.java"); + AnAction action = ActionManager.getInstance().getAction(IdeActions.ACTION_GOTO_SUPER); + AnActionEvent event = AnActionEvent.createFromAnAction(action, null, "", DataManager.getInstance().getDataContextFromFocus().getResultSync()); + action.update(event); + assertTrue(event.getPresentation().isEnabledAndVisible()); + action.actionPerformed(event); + checkResultByFile(getBasePath() + "SiblingInheritanceAndGenerics.after.java"); + } + public void testDoNotShowSiblingInheritanceLineMarkerIfSubclassImplementsTheSameInterfaceAsTheCurrentClass() throws Throwable { configureByFile(getBasePath() + "DeceivingSiblingInheritance.java"); PsiJavaFile file = (PsiJavaFile)getFile();