mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
extract class: leave reference parameters untouched after replacement (IDEA-106017)
This commit is contained in:
+2
-6
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public class Extracted {
|
||||
public static <T> T foo() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
|
||||
{
|
||||
String s = true ? Extracted.<String>foo() : "";
|
||||
}
|
||||
}
|
||||
+7
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user