PsiClassType () { PsiClassStub<?> stub = getGreenStub(); if (stub == null) { myCachedBaseType = null; return getTypeByTree(); } PsiClassType type = dereference(myCachedBaseType); if (type != null) return type; if (!isInQualifiedNew() && !isDiamond(stub)) { String refText = stub.getBaseClassReferenceText(); assert refText != null : stub; PsiElementFactory factory = JavaPsiFacade.getElementFactory(getProject()); try { PsiJavaCodeReferenceElement ref = factory.createReferenceFromText(refText, this); ((PsiJavaCodeReferenceElementImpl)ref).setKindWhenDummy(PsiJavaCodeReferenceElementImpl.Kind.CLASS_NAME_KIND); ref.getContainingFile().putUserData(STUB_BASE_CLASS_REFERENCE_HOLDER, this); type = factory.createType(ref); } catch (IncorrectOperationException e) { type = PsiType.getJavaLangObject(getManager(), getResolveScope()); } myCachedBaseType = new SoftReference<>(type); return type; } else { return getTypeByTree(); } }