deoptimize so overriding methods from object marked as abstract won't get lost (IDEA-143141)

This commit is contained in:
Anna Kozlova
2015-08-18 12:31:29 +02:00
parent c97ce52826
commit a1601f1d22
3 changed files with 29 additions and 5 deletions

View File

@@ -208,11 +208,7 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
for (CandidateInfo conflict : conflicts) {
final PsiMethod method = ((MethodCandidateInfo)conflict).getElement();
for (HierarchicalMethodSignature methodSignature : method.getHierarchicalMethodSignature().getSuperSignatures()) {
final PsiMethod superMethod = methodSignature.getMethod();
final PsiClass aClass = superMethod.getContainingClass();
if (aClass != null && !CommonClassNames.JAVA_LANG_OBJECT.equals(aClass.getQualifiedName())) {
superMethods.add(superMethod);
}
superMethods.add(methodSignature.getMethod());
}
}
nextConflict:

View File

@@ -0,0 +1,24 @@
abstract class A {
public abstract int hashCode();
public abstract boolean equals(Object obj);
public abstract void foo();
{
new A() {
@Override
public int hashCode() {
return <error descr="Abstract method 'hashCode()' cannot be accessed directly">super.hashCode()</error>;
}
@Override
public boolean equals(Object obj) {
return <error descr="Abstract method 'equals(Object)' cannot be accessed directly">super.equals(obj)</error>;
}
@Override
public void foo() {
<error descr="Abstract method 'foo()' cannot be accessed directly">super.foo()</error>;
}
};
}
}

View File

@@ -134,6 +134,10 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testOverrideObjectMethods() throws Exception {
doTest();
}
private void doTest() {
doTest(true);
}