boolean (@NotNull LookupElement element, PsiMethod method) { PsiType type = method.getReturnType(); JavaMethodCallElement callItem = element.as(JavaMethodCallElement.CLASS_CONDITION_KEY); if (callItem != null) { type = callItem.getSubstitutor().substitute(type); } if (type instanceof PsiClassType) { PsiClass target = ((PsiClassType)type).resolve(); return target instanceof PsiTypeParameter && ((PsiTypeParameter)target).getOwner() instanceof PsiMethod; } return false; }