Boolean (@NotNull final PsiClassType classType) { final PsiClassType.ClassResolveResult result = classType.resolveGenerics(); final PsiClass aClass = result.getElement(); final PsiSubstitutor aSubst = result.getSubstitutor(); if (aClass != null) { final PsiManager manager = aClass.getManager(); final JavaPsiFacade facade = JavaPsiFacade.getInstance(manager.getProject()); if (aClass instanceof PsiTypeParameter) { final PsiTypeParameterListOwner owner = PsiTreeUtil.getParentOfType(myContext, PsiTypeParameterListOwner.class); if (owner != null) { boolean found = false; for (PsiTypeParameter typeParameter : PsiUtil.typeParametersIterable(owner)) { found = manager.areElementsEquivalent(typeParameter, aClass); if (found) break; } if (!found) { return Boolean.FALSE; } } else { return Boolean.FALSE; } } else if (!facade.getResolveHelper().isAccessible(aClass, myContext, null)) { return Boolean.FALSE; } for (PsiTypeParameter parm : PsiUtil.typeParametersIterable(aClass)) { final PsiType type = aSubst.substitute(parm); if (type != null) { final Boolean b = type.accept(this); if (!b.booleanValue()) { return Boolean.FALSE; } } } return Boolean.TRUE; } else { return Boolean.FALSE; } }