boolean (@NotNull PsiClass aClass) { if (PsiTreeUtil.isAncestor(innerClass, aClass, false) || aClass.hasModifierProperty(PsiModifier.STATIC)) { return true; } if (aClass instanceof PsiTypeParameter) { PsiTypeParameterListOwner owner = ((PsiTypeParameter)aClass).getOwner(); return owner != null && PsiTreeUtil.isAncestor(innerClass, owner, false); } final PsiClass containingClass = aClass.getContainingClass(); return containingClass == null || InheritanceUtil.isInheritorOrSelf(innerClass, containingClass, true); }