pull up/push down: type parameters can be used in type parameters list as well as type elements (IDEA-57268)

This commit is contained in:
anna
2010-08-09 20:34:56 +04:00
parent 88d6d35d9f
commit e18d3e0881
4 changed files with 22 additions and 1 deletions

View File

@@ -885,7 +885,12 @@ public class RefactoringUtil {
if (substitutedType == null) {
substitutedType = TypeConversionUtil.erasure(factory.createType(parameter));
}
element.getParent().replace(factory.createTypeElement(substitutedType));
final PsiElement parent = element.getParent();
if (parent instanceof PsiTypeElement) {
parent.replace(factory.createTypeElement(substitutedType));
} else if (element instanceof PsiJavaCodeReferenceElement && substitutedType instanceof PsiClassType) {
element.replace(factory.createReferenceElementByType((PsiClassType)substitutedType));
}
}
}
}

View File

@@ -0,0 +1,6 @@
public class Test<T> {
<S extends T> void f<caret>oo(){}
}
class B extends Test<Throwable>{
}

View File

@@ -0,0 +1,6 @@
public class Test<T> {
}
class B extends Test<Throwable>{
<S extends Throwable> void foo(){}
}

View File

@@ -105,4 +105,8 @@ public class PushDownTest extends LightCodeInsightTestCase {
public void testSuperOverHierarchy() throws Exception {
doTest();
}
public void testMethodTypeParametersList() throws Exception {
doTest();
}
}