mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
push down: substitute pushed dependencies (IDEA-86870)
This commit is contained in:
@@ -392,8 +392,15 @@ public class PushDownProcessor extends BaseRefactoringProcessor {
|
||||
else if (member instanceof PsiClass) {
|
||||
if (Boolean.FALSE.equals(memberInfo.getOverrides())) {
|
||||
final PsiClass aClass = (PsiClass)memberInfo.getMember();
|
||||
PsiClassType classType = null;
|
||||
if (!targetClass.isInheritor(aClass, false)) {
|
||||
PsiJavaCodeReferenceElement classRef = factory.createClassReferenceElement(aClass);
|
||||
final PsiClassType[] types = memberInfo.getSourceReferenceList().getReferencedTypes();
|
||||
for (PsiClassType type : types) {
|
||||
if (type.resolve() == aClass) {
|
||||
classType = (PsiClassType)substitutor.substitute(type);
|
||||
}
|
||||
}
|
||||
PsiJavaCodeReferenceElement classRef = classType != null ? factory.createReferenceElementByType(classType) : factory.createClassReferenceElement(aClass);
|
||||
if (aClass.isInterface()) {
|
||||
targetClass.getImplementsList().add(classRef);
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import java.util.*;
|
||||
abstract class Test implements List<String> {
|
||||
}
|
||||
|
||||
abstract class B extends Test {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import java.util.*;
|
||||
abstract class Test {
|
||||
}
|
||||
|
||||
abstract class B extends Test implements List<String> {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import java.util.*;
|
||||
abstract class Test<T> implements List<T> {
|
||||
}
|
||||
|
||||
abstract class B extends Test<String> {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import java.util.*;
|
||||
abstract class Test<T> {
|
||||
}
|
||||
|
||||
abstract class B extends Test<String> implements List<String> {
|
||||
}
|
||||
@@ -120,6 +120,18 @@ public class PushDownTest extends LightRefactoringTestCase {
|
||||
}
|
||||
|
||||
public void testSameClassInterface() throws Exception {
|
||||
doTestImplements();
|
||||
}
|
||||
|
||||
public void testPreserveTypeArgs() throws Exception {
|
||||
doTestImplements();
|
||||
}
|
||||
|
||||
public void testSubstTypeArgs() throws Exception {
|
||||
doTestImplements();
|
||||
}
|
||||
|
||||
private void doTestImplements() {
|
||||
final String filePath = "/refactoring/pushDown/" + getTestName(false) + ".java";
|
||||
configureByFile(filePath);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user