mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] IDEA-255890 'Complete Current Statement' for vararg method like String.format works incorrectly
GitOrigin-RevId: 814641fd0562890897eec6e0a7f29c187f36c54c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
84c09cc922
commit
2a18b3e8f9
+1
-1
@@ -93,7 +93,7 @@ public class MethodCallFixer implements Fixer {
|
||||
int paramCount = Integer.MAX_VALUE;
|
||||
for (CandidateInfo candidate : PsiResolveHelper.SERVICE.getInstance(call.getProject()).getReferencedMethodCandidates(call, false)) {
|
||||
PsiElement element = candidate.getElement();
|
||||
if (element instanceof PsiMethod) {
|
||||
if (element instanceof PsiMethod && !((PsiMethod)element).isVarArgs()) {
|
||||
paramCount = Math.min(paramCount, ((PsiMethod)element).getParameterList().getParametersCount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
public class VarargMethod {
|
||||
void test() {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(String.format("m", p1, p2)<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
public class VarargMethod {
|
||||
void test() {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(String.format("m", p1, p2));
|
||||
}
|
||||
}
|
||||
@@ -181,6 +181,7 @@ public class CompleteStatementTest extends EditorActionTestCase {
|
||||
public void testRecord() { doTest(); }
|
||||
public void testRecordWithComponent() { doTest(); }
|
||||
public void testRecordWithComponentNoBody() { doTest(); }
|
||||
public void testVarargMethod() { doTest(); }
|
||||
|
||||
private void doTestBracesNextLineStyle() {
|
||||
myJavaSettings.BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
|
||||
|
||||
Reference in New Issue
Block a user