[java] IDEA-256275 Improve Remove-redundant-argument-to-call quick-fix so it can handle redundant arguments not only at the end of argument list

#IDEA-256275 Fixed

Merge-request: IJ-MR-177887
Merged-by: Marcin Mikosik <marcin.mikosik@jetbrains.com>

GitOrigin-RevId: 156ea485dd409ef5ec937da1872f97ede359bdff
This commit is contained in:
Marcin Mikosik
2025-10-09 13:12:30 +00:00
committed by intellij-monorepo-bot
parent 9950569576
commit bc62ddef92
17 changed files with 241 additions and 12 deletions
@@ -0,0 +1,9 @@
// "Remove redundant argument to call 'method(int, T...)'" "true-preview"
class A {
public void foo() {
method(1, "def", 2);
}
private <T> void method(int i, T... ts) {
}
}
@@ -0,0 +1,9 @@
// "Remove redundant arguments to call 'method(boolean, T...)'" "true-preview"
class A {
public void foo() {
method(true, 7);
}
private <T extends Number> void method(boolean b, T... ts) {
}
}
@@ -0,0 +1,9 @@
// "Remove redundant argument to call 'method(String)'" "true-preview"
class A {
public A() {
method("abc");
}
private void method(String string) {
}
}
@@ -0,0 +1,9 @@
// "Remove redundant argument to call 'method(int, String)'" "true-preview"
class A {
public A() {
method(<caret>5, "abc");
}
private void method(int i, String string) {
}
}
@@ -0,0 +1,9 @@
// "Remove redundant argument to call 'method(String...)'" "true-preview"
class A {
public A() {
method(<caret>"abc", "def");
}
private void method(String... strings) {
}
}
@@ -0,0 +1,9 @@
// "Remove redundant argument to call 'method(String...)'" "true-preview"
class A {
public A() {
method("abc", "def");
}
private void method(String... strings) {
}
}
@@ -0,0 +1,9 @@
// "Remove redundant argument to call 'method(String...)'" "true-preview"
class A {
public A() {
method("abc", "def");
}
private void method(String... strings) {
}
}
@@ -0,0 +1,9 @@
// "Remove redundant argument to call 'method(String...)'" "true-preview"
class A {
public A() {
method(new String[] {"abc", "def"});
}
private void method(String... strings) {
}
}
@@ -0,0 +1,9 @@
// "Remove redundant argument to call 'method(int, T...)'" "true-preview"
class A {
public void foo() {
method(<caret>"abc", 1, "def", 2);
}
private <T> void method(int i, T... ts) {
}
}
@@ -0,0 +1,9 @@
// "Remove redundant arguments to call 'method(boolean, T...)'" "true-preview"
class A {
public void foo() {
method(<caret>"abc", true, 7, "def");
}
private <T extends Number> void method(boolean b, T... ts) {
}
}
@@ -0,0 +1,9 @@
// "Remove redundant argument to call 'method(String)'" "true-preview"
class A {
public A() {
method(<caret>5, "abc");
}
private void method(String string) {
}
}
@@ -0,0 +1,9 @@
// "Remove redundant argument to call 'method(int, String)'" "true-preview"
class A {
public A() {
method(<caret>5, true, "abc");
}
private void method(int i, String string) {
}
}
@@ -0,0 +1,9 @@
// "Remove redundant argument to call 'method(String...)'" "true-preview"
class A {
public A() {
method(<caret>"abc", "def", 5);
}
private void method(String... strings) {
}
}
@@ -0,0 +1,9 @@
// "Remove redundant argument to call 'method(String...)'" "true-preview"
class A {
public A() {
method(<caret>5, "abc", "def");
}
private void method(String... strings) {
}
}
@@ -0,0 +1,9 @@
// "Remove redundant argument to call 'method(String...)'" "true-preview"
class A {
public A() {
method(<caret>"abc", "def", 5);
}
private void method(String... strings) {
}
}
@@ -0,0 +1,9 @@
// "Remove redundant argument to call 'method(String...)'" "true-preview"
class A {
public A() {
method(<caret>5, new String[] {"abc", "def"});
}
private void method(String... strings) {
}
}