use interface where possible: ignore right hand of assignment type argument (IDEADEV-39117)

This commit is contained in:
anna
2009-10-08 11:47:56 +04:00
parent 24d39869bb
commit d7da82925e
14 changed files with 46 additions and 0 deletions
@@ -273,6 +273,12 @@ public abstract class TurnRefsToSuperProcessorBase extends BaseRefactoringProces
} else if (classReference.getParent() instanceof PsiTypeElement) {
processUsage(classReference);
return;
} else if (classReference.getParent() instanceof PsiNewExpression) {
final PsiVariable variable = PsiTreeUtil.getParentOfType(classReference, PsiVariable.class);
if (variable != null) {
processUsage(variable);
return;
}
}
}
markNode(ref); //???
@@ -0,0 +1 @@
interface I{}
@@ -0,0 +1 @@
class IImpl implements I{}
@@ -0,0 +1,6 @@
import java.util.*;
class U {
public static void main(String[] args) {
List<List<I>> l = new ArrayLits<List<I>>();
}
}
@@ -0,0 +1 @@
interface I{}
@@ -0,0 +1 @@
class IImpl implements I{}
@@ -0,0 +1,6 @@
import java.util.*;
class U {
public static void main(String[] args) {
List<List<IImpl>> l = new ArrayLits<List<IImpl>>();
}
}
@@ -0,0 +1 @@
interface I{}
@@ -0,0 +1 @@
class IImpl implements I{}
@@ -0,0 +1,6 @@
import java.util.*;
class U {
public static void main(String[] args) {
List<I> l = new ArrayLits<I>();
}
}
@@ -0,0 +1 @@
class IImpl implements I{}
@@ -0,0 +1,6 @@
import java.util.*;
class U {
public static void main(String[] args) {
List<IImpl> l = new ArrayLits<IImpl>();
}
}
@@ -117,6 +117,14 @@ public class TurnRefsToSuperTest extends MultiFileTestCase {
doTest("B", "A", false);
}
public void testTypeArgumentsRH() throws Exception {
doTest("IImpl", "I", false);
}
public void testTypeArgumentsRH1() throws Exception {
doTest("IImpl", "I", false);
}
private void doTest(@NonNls final String className, @NonNls final String superClassName, final boolean replaceInstanceOf) throws Exception {
doTest(new PerformAction() {
public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {