LookupElement (PsiClass psiClass, Set<? extends PsiClass> toWildcardInheritors) { final PsiTypeParameter[] typeParameters = psiClass.getTypeParameters(); if (typeParameters.length > 0) { for (final PsiClass parameterizedType : toWildcardInheritors) { if (psiClass.isInheritor(parameterizedType, true)) { PsiSubstitutor substitutor = PsiSubstitutor.EMPTY; final PsiWildcardType wildcard = PsiWildcardType.createUnbounded(psiClass.getManager()); for (final PsiTypeParameter typeParameter : typeParameters) { substitutor = substitutor.put(typeParameter, wildcard); } final PsiElementFactory factory = JavaPsiFacade.getElementFactory(psiClass.getProject()); return PsiTypeLookupItem.createLookupItem(factory.createType(psiClass, substitutor), psiClass); } } } return new JavaPsiClassReferenceElement(psiClass); }