void (PsiClass targetClass, String superClassName) { JavaPsiFacade facade = JavaPsiFacade.getInstance(targetClass.getProject()); PsiElementFactory factory = facade.getElementFactory(); final PsiClass superClass = facade.findClass(superClassName, targetClass.getResolveScope()); final PsiJavaCodeReferenceElement superClassReference = factory.createReferenceElementByFQClassName(superClassName, targetClass.getResolveScope()); final PsiReferenceList list = targetClass.isInterface() || superClass == null || !superClass.isInterface() ? targetClass.getExtendsList() : targetClass.getImplementsList(); list.add(superClassReference); }