void (MemberInfo info, PsiClass aClass, PsiSubstitutor substitutor, GrTypeDefinition targetSuperClass) { final PsiReferenceList sourceReferenceList = info.getSourceReferenceList(); LOG.assertTrue(sourceReferenceList != null); PsiQualifiedReferenceElement ref = mySourceClass.equals(sourceReferenceList.getParent()) ? removeFromReferenceList(sourceReferenceList, aClass) : findReferenceToClass(sourceReferenceList, aClass); if (ref != null && !targetSuperClass.isInheritor(aClass, false)) { GroovyPsiElementFactory elementFactory = GroovyPsiElementFactory.getInstance(myProject); replaceMovedMemberTypeParameters(ref, PsiUtil.typeParametersIterable(mySourceClass), substitutor, elementFactory); GrReferenceList referenceList; if (targetSuperClass.isInterface()) { referenceList = targetSuperClass.getExtendsClause(); if (referenceList == null) { GrExtendsClause newClause = GroovyPsiElementFactory.getInstance(myProject).createExtendsClause(); PsiElement anchor = targetSuperClass.getTypeParameterList() != null ? targetSuperClass.getTypeParameterList(): targetSuperClass.getNameIdentifierGroovy(); referenceList = (GrReferenceList)targetSuperClass.addAfter(newClause, anchor); addSpacesAround(referenceList); } } else { referenceList = targetSuperClass.getImplementsClause(); if (referenceList == null) { GrImplementsClause newClause = GroovyPsiElementFactory.getInstance(myProject).createImplementsClause(); PsiElement anchor = targetSuperClass.getExtendsClause() != null ? targetSuperClass.getExtendsClause() : targetSuperClass.getTypeParameterList() != null ? targetSuperClass.getTypeParameterList() : targetSuperClass.getNameIdentifierGroovy(); referenceList = (GrReferenceList)targetSuperClass.addAfter(newClause, anchor); addSpacesAround(referenceList); } } referenceList.add(ref); } }