mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inplace introduce: do not replace identifier with method expr even when ref names equals (IDEA-97536)
This commit is contained in:
+1
-1
@@ -139,7 +139,7 @@ public abstract class AbstractJavaInplaceIntroducer extends AbstractInplaceIntro
|
||||
PsiExpression expression = refVariableElement instanceof PsiKeyword && refVariableElementParent instanceof PsiNewExpression
|
||||
? (PsiNewExpression)refVariableElementParent
|
||||
: PsiTreeUtil.getParentOfType(refVariableElement, PsiReferenceExpression.class);
|
||||
if (expression instanceof PsiReferenceExpression) {
|
||||
if (expression instanceof PsiReferenceExpression && !(expression.getParent() instanceof PsiMethodCallExpression)) {
|
||||
final String referenceName = ((PsiReferenceExpression)expression).getReferenceName();
|
||||
if (((PsiReferenceExpression)expression).resolve() == psiVariable ||
|
||||
Comparing.strEqual(psiVariable.getName(), referenceName) ||
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class A {
|
||||
int f() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void m() {
|
||||
f<caret>();
|
||||
f();
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
int f() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void m(int f) {
|
||||
f();
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,14 @@ public class InplaceIntroduceParameterTest extends AbstractJavaInplaceIntroduceT
|
||||
});
|
||||
}
|
||||
|
||||
public void testParamNameEqMethodName() throws Exception {
|
||||
doTest(new Pass<AbstractInplaceIntroducer>() {
|
||||
@Override
|
||||
public void pass(AbstractInplaceIntroducer inplaceIntroducePopup) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return BASE_PATH;
|
||||
|
||||
Reference in New Issue
Block a user