inline parameter: allow inlining with different call sites

GitOrigin-RevId: 4d580bcd0f80076921111eae235f167fa98058f5
This commit is contained in:
Anna Kozlova
2020-03-16 10:03:08 +00:00
committed by intellij-monorepo-bot
parent 5eb49a4db7
commit 948ebcc12e
3 changed files with 7 additions and 9 deletions
@@ -99,9 +99,7 @@ public class InlineParameterHandler extends JavaInlineActionHandler {
if (expressions.length <= index) return false;
PsiExpression argument = expressions[index];
if (!refInitializer.isNull()) {
return argument != null
&& PsiEquivalenceUtil.areElementsEquivalent(refInitializer.get(), argument)
&& PsiEquivalenceUtil.areElementsEquivalent(refMethodCall.get(), methodCall);
return argument != null && PsiEquivalenceUtil.areElementsEquivalent(refInitializer.get(), argument);
}
if (InlineToAnonymousConstructorProcessor.isConstant(argument) || getReferencedFinalField(argument) != null) {
if (refConstantInitializer.isNull()) {
@@ -2,12 +2,12 @@ public class Subject {
private int myInt;
private int t;
public void wp(int <caret>p) {
public void wp(String s, int <caret>p) {
myInt += p;
}
void foo() {
wp(t);
wp(t);
wp("s1", t);
wp("s2", t);
}
}
@@ -2,12 +2,12 @@ public class Subject {
private int myInt;
private int t;
public void wp() {
public void wp(String s) {
myInt += t;
}
void foo() {
wp();
wp();
wp("s1");
wp("s2");
}
}