diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java index f4ec240b7f2d..d1a44922714a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java @@ -973,7 +973,7 @@ public class HighlightMethodUtil { PsiClass[] interfaces = aClass.getInterfaces(); for (PsiClass aInterfaces : interfaces) { superClass = aInterfaces; - superMethod = MethodSignatureUtil.findMethodBySignature(superClass, method, true); + superMethod = MethodSignatureUtil.findMethodInSuperClassBySignatureInDerived(aClass, superClass, method.getSignature(PsiSubstitutor.EMPTY), true); highlightInfo = checkStaticMethodOverride(aClass, method, true, superClass, superMethod); if (highlightInfo != null) return highlightInfo; } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/StaticOverride.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/StaticOverride.java new file mode 100644 index 000000000000..a40423ec39ab --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/StaticOverride.java @@ -0,0 +1,8 @@ +import java.util.*; + +public class MyClass implements Comparator { + + public static int compare(String a, String b) { + return 42; + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java index 5ce67a32dfc7..3ebc98e69a9c 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java @@ -150,6 +150,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase { public void testInconvertibleTypes() throws Exception { doTest(false); } public void testIncompatibleReturnType() throws Exception { doTest(false); } public void testContinueInferenceAfterFirstRawResult() throws Exception { doTest(false); } + public void testStaticOverride() throws Exception { doTest(false); } public void testJavaUtilCollections_NoVerify() throws Exception { PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));