boolean (PsiClass aClass) { if (!(aClass instanceof PsiAnonymousClass anonymousClass)) { final PsiReferenceList extendsList = aClass.getExtendsList(); final PsiReferenceList implementsList = aClass.getImplementsList(); return hasTypeArguments(extendsList) || hasTypeArguments(implementsList); } final PsiJavaCodeReferenceElement reference = anonymousClass.getBaseClassReference(); final PsiReferenceParameterList parameterList = reference.getParameterList(); if (parameterList == null) { return false; } final PsiTypeElement[] elements = parameterList.getTypeParameterElements(); for (PsiTypeElement element : elements) { if (element != null) { return true; } } return false; }