PsiClassType (final PsiClass aClass) { PsiElementFactory factory = JavaPsiFacade.getElementFactory(aClass.getProject()); PsiClassType superType; PsiClass superClass = aClass.getSuperClass(); if (superClass == null) { //java.lang.Object was not found return null; } PsiClassType[] interfaceTypes = aClass.getImplementsListTypes(); if (interfaceTypes.length > 0 && !InlineToAnonymousClassHandler.isRedundantImplements(superClass, interfaceTypes [0])) { superType = interfaceTypes [0]; } else { PsiClassType[] classTypes = aClass.getExtendsListTypes(); if (classTypes.length > 0) { superType = classTypes [0]; } else { superType = factory.createType(superClass); } } return superType; }