do not replace anonymous inheritance with delegation

This commit is contained in:
anna
2009-10-05 21:45:28 +04:00
parent d962ca4694
commit a3815f908e
4 changed files with 18 additions and 3 deletions
@@ -552,6 +552,7 @@ public class InheritanceToDelegationProcessor extends BaseRefactoringProcessor {
private void addImplementingInterfaces() throws IncorrectOperationException {
final PsiReferenceList implementsList = myClass.getImplementsList();
LOG.assertTrue(implementsList != null);
for (PsiClass delegatedInterface : myDelegatedInterfaces) {
if (!myClassImplementedInterfaces.contains(delegatedInterface)) {
implementsList.add(myFactory.createClassReferenceElement(delegatedInterface));
@@ -560,6 +561,7 @@ public class InheritanceToDelegationProcessor extends BaseRefactoringProcessor {
if (!myBaseClass.isInterface()) {
final PsiReferenceList extendsList = myClass.getExtendsList();
LOG.assertTrue(extendsList != null);
extendsList.getReferenceElements()[0].delete();
} else {
final PsiJavaCodeReferenceElement[] interfaceRefs = implementsList.getReferenceElements();