mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
[java-intention] MoveParenthesisFix: remove unnecessary MethodCandidateInfo check
It prevented from finding single correct version if multiple overloads are available GitOrigin-RevId: 8759aaaee8f0b7cce044a3bf447661e5ea30dabe
This commit is contained in:
committed by
intellij-monorepo-bot
parent
68a1ee119f
commit
a7fbd25b9e
@@ -13,7 +13,6 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.infos.CandidateInfo;
|
||||
import com.intellij.psi.infos.MethodCandidateInfo;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
@@ -123,11 +122,9 @@ public final class MoveParenthesisFix implements IntentionAction, HighPriorityAc
|
||||
PsiCallExpression copy = copyWithShift(parentCall, pos, shift);
|
||||
if (copy == null) continue;
|
||||
JavaResolveResult parentResolve = copy.resolveMethodGenerics();
|
||||
if (!(parentResolve instanceof MethodCandidateInfo)) return false;
|
||||
if (!parentResolve.isValidResult()) continue;
|
||||
var childCopy = (PsiCallExpression)Objects.requireNonNull(copy.getArgumentList()).getExpressions()[pos];
|
||||
JavaResolveResult childResolve = childCopy.resolveMethodGenerics();
|
||||
if (!(childResolve instanceof MethodCandidateInfo)) return false;
|
||||
if (!childResolve.isValidResult()) continue;
|
||||
if (fix != null) return false;
|
||||
fix = new MoveParenthesisFix(parentCall, pos, shift);
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// "Fix closing parenthesis placement" "true"
|
||||
public class Example {
|
||||
String foo(String s, boolean b) {
|
||||
return s;
|
||||
}
|
||||
|
||||
String foo(String s, int i) {
|
||||
return s;
|
||||
}
|
||||
|
||||
String bar(String s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
String bar(String s, boolean b1) {
|
||||
return s;
|
||||
}
|
||||
|
||||
void test() {
|
||||
foo(bar("hello", true), true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// "Fix closing parenthesis placement" "true"
|
||||
public class Example {
|
||||
String foo(String s, boolean b) {
|
||||
return s;
|
||||
}
|
||||
|
||||
String foo(String s, int i) {
|
||||
return s;
|
||||
}
|
||||
|
||||
String bar(String s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
String bar(String s, boolean b1) {
|
||||
return s;
|
||||
}
|
||||
|
||||
void test() {
|
||||
foo(bar("hello"<caret>, true, true));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user