@NotNull public static PsiClassType[] getImplementsListTypes(@NotNull PsiClass psiClass) { final PsiReferenceList extendsList = psiClass.getImplementsList(); if (extendsList != null) { return extendsList.getReferencedTypes(); } return PsiClassType.EMPTY_ARRAY; }
private static List<PsiClassType> getSuperTypes(PsiClass clazz) { if (clazz instanceof GrTypeDefinition) { final GrExtendsClause elist = ((GrTypeDefinition) clazz).getExtendsClause(); final GrImplementsClause ilist = ((GrTypeDefinition) clazz).getImplementsClause(); if (elist == null && ilist == null) return ContainerUtil.emptyList(); final ArrayList<PsiClassType> types = new ArrayList<PsiClassType>(); if (elist != null) ContainerUtil.addAll(types, elist.getReferencedTypes()); if (ilist != null) ContainerUtil.addAll(types, ilist.getReferencedTypes()); return types; } else { final PsiReferenceList elist = clazz.getExtendsList(); final PsiReferenceList ilist = clazz.getImplementsList(); if (elist == null && ilist == null) return ContainerUtil.emptyList(); final ArrayList<PsiClassType> types = new ArrayList<PsiClassType>(); if (elist != null) ContainerUtil.addAll(types, elist.getReferencedTypes()); if (ilist != null) ContainerUtil.addAll(types, ilist.getReferencedTypes()); return types; } }
@NotNull public static PsiClassType[] getExtendsListTypes(@NotNull PsiClass psiClass) { if (psiClass.isEnum()) { PsiClassType enumSuperType = getEnumSuperType( psiClass, JavaPsiFacade.getInstance(psiClass.getProject()).getElementFactory()); return enumSuperType == null ? PsiClassType.EMPTY_ARRAY : new PsiClassType[] {enumSuperType}; } if (psiClass.isAnnotationType()) { return new PsiClassType[] { getAnnotationSuperType( psiClass, JavaPsiFacade.getInstance(psiClass.getProject()).getElementFactory()) }; } final PsiReferenceList extendsList = psiClass.getExtendsList(); if (extendsList != null) { return extendsList.getReferencedTypes(); } return PsiClassType.EMPTY_ARRAY; }