@Nullable private StubElement getContextStub() { PsiClassStub<?> stub = getStub(); if(stub == null) { return null; } // if AST is not loaded, then we only can need context to resolve supertype references // this can be done by stubs unless there are local/anonymous classes referencing other local classes StubElement parent = stub.getParentStub(); if(parent instanceof PsiClassInitializerStub || parent instanceof PsiMethodStub) { if(parent.getChildrenByType(JavaStubElementTypes.CLASS, PsiElement.ARRAY_FACTORY).length <= 1) { parent = parent.getParentStub(); } } return parent instanceof PsiClassStub ? parent : null; }
public PsiClassInitializerImpl(final PsiClassInitializerStub stub) { super(stub, JavaStubElementTypes.CLASS_INITIALIZER); }