boolean (PsiElement element) { if (element instanceof PsiClass) { return !(element instanceof PsiTypeParameter); } else if (element instanceof PsiMethod) { return true; } else if (element instanceof PsiJavaCodeReferenceElement referenceElement) { if (PsiTreeUtil.getParentOfType(element, PsiImportStatement.class, PsiPackageStatement.class) != null) { return false; } final PsiReferenceParameterList parameterList = referenceElement.getParameterList(); if (parameterList != null) { return true; } } return false; }