check overriding in correct order (IDEA-97506)

This commit is contained in:
anna
2012-12-14 18:36:43 +01:00
parent d29e6b8b99
commit 5aa6fe3572
3 changed files with 19 additions and 3 deletions
@@ -215,15 +215,15 @@ public class PsiSuperMethodImplUtil {
LOG.assertTrue(copy.getMethod().isValid());
map.put(signature, copy);
}
else if (isSuperMethod(aClass, existing, hierarchicalMethodSignature)) {
mergeSupers(existing, hierarchicalMethodSignature);
}
else if (isReturnTypeIsMoreSpecificThan(hierarchicalMethodSignature, existing) && isSuperMethod(aClass, hierarchicalMethodSignature, existing)) {
HierarchicalMethodSignatureImpl newSuper = copy(hierarchicalMethodSignature);
mergeSupers(newSuper, existing);
LOG.assertTrue(newSuper.getMethod().isValid());
map.put(signature, newSuper);
}
else if (isSuperMethod(aClass, existing, hierarchicalMethodSignature)) {
mergeSupers(existing, hierarchicalMethodSignature);
}
// just drop an invalid method declaration there - to highlight accordingly
else if (!result.containsKey(signature)) {
LOG.assertTrue(hierarchicalMethodSignature.getMethod().isValid());
@@ -0,0 +1,15 @@
import java.util.List;
interface ExampleInterface {
public List exampleMethod();
}
class ExampleSuperClass {
public List<String> exampleMethod() {
return null;
}
}
public class ExampleSubClass extends ExampleSuperClass implements ExampleInterface {
}
@@ -206,6 +206,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testFlattenIntersectionType() throws Exception { doTest17Incompatibility(false); }
public void testIDEA97276() throws Exception { doTest17Incompatibility(false); }
public void testWildcardsBoundsIntersection() throws Exception { doTest17Incompatibility(false); }
public void testOverrideWithMoreSpecificReturn() throws Exception { doTest17Incompatibility(false); }
public void testJavaUtilCollections_NoVerify() throws Exception {
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));