static override: search method in superclass by method signature from derived (IDEA-93043)

This commit is contained in:
anna
2012-10-17 15:49:58 +02:00
parent d97c44a0ad
commit 78c8fe106b
3 changed files with 10 additions and 1 deletions
@@ -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;
}
@@ -0,0 +1,8 @@
import java.util.*;
public class MyClass implements Comparator<String> {
<error descr="Static method 'compare(String, String)' in 'MyClass' cannot override instance method 'compare(T, T)' in 'java.util.Comparator'">public static int compare(String a, String b)</error> {
return 42;
}
}
@@ -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()));