mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
deoptimize so overriding methods from object marked as abstract won't get lost (IDEA-143141)
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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>;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -134,6 +134,10 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testOverrideObjectMethods() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user