PsiClass () { 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; }