use of com.intellij.psi.impl.java.stubs.PsiClassStub in project intellij-community by JetBrains.
the class PsiClassImpl method getContainingClass.
@Override
@Nullable
public PsiClass getContainingClass() {
final PsiClassStub stub = getGreenStub();
if (stub != null) {
StubElement parent = stub.getParentStub();
return parent instanceof PsiClassStub ? ((PsiClassStub<?>) parent).getPsi() : null;
}
PsiElement parent = getParent();
if (parent instanceof PsiClassLevelDeclarationStatement) {
return PsiTreeUtil.getParentOfType(this, PsiSyntheticClass.class);
}
return parent instanceof PsiClass ? (PsiClass) parent : null;
}
use of com.intellij.psi.impl.java.stubs.PsiClassStub in project intellij-community by JetBrains.
the class PsiClassImpl method isAnonymousOrLocal.
private static boolean isAnonymousOrLocal(PsiClass aClass) {
if (aClass instanceof PsiAnonymousClass)
return true;
final PsiClassStub stub = ((PsiClassImpl) aClass).getGreenStub();
if (stub != null) {
final StubElement parentStub = stub.getParentStub();
return !(parentStub instanceof PsiClassStub || parentStub instanceof PsiFileStub);
}
PsiElement parent = aClass.getParent();
while (parent != null) {
if (parent instanceof PsiMethod || parent instanceof PsiField || parent instanceof PsiClassInitializer)
return true;
if (parent instanceof PsiClass || parent instanceof PsiFile)
return false;
parent = parent.getParent();
}
return false;
}
Aggregations