mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
correct resolving supers of a class directly inside anonymous, when AST is not loaded (EA-84982 - assert: TypeConversionUtil.reportHierarchyInconsistency)
This commit is contained in:
@@ -183,15 +183,7 @@ public class PsiAnonymousClassImpl extends PsiClassImpl implements PsiAnonymousC
|
||||
@NotNull PsiElement place) {
|
||||
if (lastParent instanceof PsiExpressionList) return true;
|
||||
|
||||
final PsiClassStub stub = getStub();
|
||||
if (stub != null) {
|
||||
// no tree is loaded
|
||||
// that means we could not have come from resolving something inside anonymous class, we just resolving the base class reference
|
||||
// so skip the (very expensive) getBaseClassReference() call which would load tree
|
||||
return true;
|
||||
}
|
||||
|
||||
if (lastParent != null/* IMPORTANT: do not call getBaseClassReference() for lastParent == null and lastParent which is not under our node - loads tree!*/
|
||||
if (lastParent instanceof PsiJavaCodeReferenceElement/* IMPORTANT: do not call getBaseClassReference() for lastParent == null and lastParent which is not under our node - loads tree!*/
|
||||
&& lastParent.getParent() == this && lastParent == getBaseClassReference()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -116,11 +116,14 @@ class A {
|
||||
Object field = new B() {
|
||||
void foo(Object o) {
|
||||
}
|
||||
|
||||
class MyInner extends Inner {}
|
||||
};
|
||||
}
|
||||
|
||||
class B {
|
||||
void foo(Object o) {}
|
||||
static class Inner {}
|
||||
}
|
||||
""")
|
||||
assert !file.contentsLoaded
|
||||
@@ -138,6 +141,8 @@ class B {
|
||||
assert !file.contentsLoaded
|
||||
|
||||
assert bClass == override.containingClass.superClass
|
||||
assert bClass.innerClasses[0] == override.containingClass.innerClasses[0].superClass
|
||||
assert !file.contentsLoaded
|
||||
}
|
||||
|
||||
public void "test AST can be gc-ed and recreated"() {
|
||||
|
||||
Reference in New Issue
Block a user