mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] do not load ast while resolving GrAnonymousClassDefinitionImpl#getBaseClassType (IDEA-155550)
This commit is contained in:
+6
-11
@@ -63,6 +63,10 @@ public class GrAnonymousClassDefinitionImpl extends GrTypeDefinitionImpl impleme
|
||||
@Override
|
||||
@NotNull
|
||||
public GrCodeReferenceElement getBaseClassReferenceGroovy() {
|
||||
GrTypeDefinitionStub stub = getStub();
|
||||
if (stub != null) {
|
||||
return GroovyPsiElementFactory.getInstance(getProject()).createReferenceElementFromText(stub.getBaseClassName(), this);
|
||||
}
|
||||
//noinspection ConstantConditions
|
||||
return findNotNullChildByClass(GrCodeReferenceElement.class); //not null because of definition =)
|
||||
}
|
||||
@@ -108,23 +112,14 @@ public class GrAnonymousClassDefinitionImpl extends GrTypeDefinitionImpl impleme
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiClassType getBaseClassType() {
|
||||
final GrTypeDefinitionStub stub = getStub();
|
||||
if (stub == null) {
|
||||
myCachedBaseType = null;
|
||||
if (isInQualifiedNew()) {
|
||||
return createClassType();
|
||||
}
|
||||
|
||||
PsiClassType type = SoftReference.dereference(myCachedBaseType);
|
||||
if (type != null && type.isValid()) return type;
|
||||
|
||||
if (isInQualifiedNew()) {
|
||||
return createClassType();
|
||||
}
|
||||
|
||||
final String refText = stub.getBaseClassName();
|
||||
assert refText != null : stub;
|
||||
type = new GrClassReferenceType(GroovyPsiElementFactory.getInstance(getProject()).createReferenceElementFromText(refText, this));
|
||||
|
||||
type = createClassType();
|
||||
myCachedBaseType = new SoftReference<PsiClassType>(type);
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.psi.*
|
||||
import com.intellij.psi.impl.source.PsiFileImpl
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.psi.stubs.StubIndex
|
||||
import com.intellij.psi.util.InheritanceUtil
|
||||
import groovy.transform.CompileStatic
|
||||
import org.jetbrains.plugins.groovy.LightGroovyTestCase
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrAnonymousClassDefinition
|
||||
@@ -267,5 +268,9 @@ class A {
|
||||
definition.baseClassType
|
||||
assert psiFile.stub
|
||||
assert !psiFile.contentsLoaded
|
||||
|
||||
assert InheritanceUtil.isInheritor(definition, Runnable.name)
|
||||
assert psiFile.stub
|
||||
assert !psiFile.contentsLoaded
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user