extract class: leave reference parameters untouched after replacement (IDEA-106017)

This commit is contained in:
anna
2013-04-23 16:53:58 +02:00
parent 35e1d2df1d
commit 1b0f032a13
5 changed files with 24 additions and 6 deletions
@@ -15,10 +15,7 @@
*/
package com.intellij.refactoring.extractclass.usageInfo;
import com.intellij.psi.PsiExpression;
import com.intellij.psi.PsiExpressionList;
import com.intellij.psi.PsiMethodCallExpression;
import com.intellij.psi.PsiReferenceExpression;
import com.intellij.psi.*;
import com.intellij.refactoring.psi.MutationUtils;
import com.intellij.refactoring.util.FixableUsageInfo;
import com.intellij.util.IncorrectOperationException;
@@ -39,8 +36,7 @@ public class RetargetStaticMethodCall extends FixableUsageInfo {
if (qualifier == null) {
MutationUtils.replaceExpression(delegateClassName + '.' + call.getText(), call);
} else {
final PsiExpressionList parameterList = call.getArgumentList();
MutationUtils.replaceExpression(delegateClassName + '.' + methodExpression.getReferenceName() +parameterList.getText() , call);
MutationUtils.replaceExpression(delegateClassName , qualifier);
}
}
}
@@ -0,0 +1,5 @@
public class Extracted {
public static <T> T foo() {
return null;
}
}
@@ -0,0 +1,6 @@
class Test {
{
String s = true ? Extracted.<String>foo() : "";
}
}
@@ -0,0 +1,7 @@
class Test {
public static <T> T foo() { return null; }
{
String s = true ? Test.<String>foo() : "";
}
}
@@ -101,6 +101,10 @@ public class ExtractClassTest extends MultiFileTestCase{
doTestMethod();
}
public void testImplicitReferenceTypeParameters() throws Exception {
doTestMethod();
}
public void testNoConstructorParams() throws Exception {
doTestFieldAndMethod();
}