PsiType () { final PsiJavaCodeReferenceElement qualifier = getQualifier(); if (qualifier != null) { final PsiElement aClass = qualifier.resolve(); if (!(aClass instanceof PsiClass)) return null; return getSuperType((PsiClass)aClass, PsiUtil.isLanguageLevel8OrHigher(this)); } for (PsiElement scope = getContext(); scope != null; scope = scope.getContext()) { if (scope instanceof PsiClass) { final PsiClass aClass = (PsiClass)scope; return getSuperType(aClass, false); } if (scope instanceof PsiExpressionList && scope.getParent() instanceof PsiAnonymousClass) { //noinspection AssignmentToForLoopParameter scope = scope.getParent(); } else if (scope instanceof JavaCodeFragment) { PsiType fragmentSuperType = ((JavaCodeFragment)scope).getSuperType(); if (fragmentSuperType != null) return fragmentSuperType; } } return null; }