push down: erase type arguments for raw subtypes (IDEA-53405)

This commit is contained in:
anna
2010-03-30 21:00:36 +04:00
parent 7e5a1be9f8
commit 9cb223e375
4 changed files with 19 additions and 3 deletions
@@ -334,10 +334,11 @@ public class PushDownProcessor extends BaseRefactoringProcessor {
if (member != null) {
for (MemberInfo memberInfo : myMemberInfos) {
if (PsiTreeUtil.isAncestor(memberInfo.getMember(), member, false)) {
final PsiType substitutedType = substitutor.substitute(parameter);
if (substitutedType != null) {
element.getParent().replace(factory.createTypeElement(substitutedType));
PsiType substitutedType = substitutor.substitute(parameter);
if (substitutedType == null) {
substitutedType = TypeConversionUtil.erasure(factory.createType(parameter));
}
element.getParent().replace(factory.createTypeElement(substitutedType));
break;
}
}
@@ -0,0 +1,5 @@
public class Parent<T> {
void <caret>foo(T t){}
}
class Child extends Parent {}
@@ -0,0 +1,6 @@
public class Parent<T> {
}
class Child extends Parent {
void foo(Object t){}
}
@@ -69,6 +69,10 @@ public class PushDownTest extends LightCodeInsightTestCase {
doTest();
}
public void testTypeParameterErasure() throws Exception {
doTest();
}
public void testFieldTypeParameter() throws Exception {
doTest();
}