IDEA-216467 "Lambda can be replaced with method reference" does not detect all cases with varargs

GitOrigin-RevId: 232800df8754a17bc8358640b675bc5a8903dfce
This commit is contained in:
Tagir Valeev
2020-06-09 16:45:07 +07:00
committed by intellij-monorepo-bot
parent dca558d695
commit b0929155eb
7 changed files with 71 additions and 24 deletions

View File

@@ -0,0 +1,10 @@
// "Replace lambda with method reference" "true"
import java.util.function.BiFunction;
import java.util.Arrays;
import java.util.List;
class Example {
public static void main(String[] args) {
BiFunction<String, String, List<String>> f3 = Arrays::asList;
}
}

View File

@@ -0,0 +1,9 @@
// "Replace lambda with method reference" "true"
import java.util.function.Function;
class Example {
public static void main(String[] args) {
Function<String, Example> f1 = Example::new;
}
public Example(String a, String... b) {}
}

View File

@@ -0,0 +1,9 @@
// "Replace lambda with method reference" "true"
import java.util.function.BiFunction;
class Example {
public static void main(String[] args) {
BiFunction<String, String, Example> f3 = Example::new;
}
public Example(String a, String... b) {}
}

View File

@@ -0,0 +1,10 @@
// "Replace lambda with method reference" "true"
import java.util.function.BiFunction;
import java.util.Arrays;
import java.util.List;
class Example {
public static void main(String[] args) {
BiFunction<String, String, List<String>> f3 = (a, b) -> Arrays.<caret>asList(a, b);
}
}

View File

@@ -0,0 +1,9 @@
// "Replace lambda with method reference" "true"
import java.util.function.Function;
class Example {
public static void main(String[] args) {
Function<String, Example> f1 = a -> new<caret> Example(a);
}
public Example(String a, String... b) {}
}

View File

@@ -0,0 +1,9 @@
// "Replace lambda with method reference" "true"
import java.util.function.BiFunction;
class Example {
public static void main(String[] args) {
BiFunction<String, String, Example> f3 = (a, b) -> new<caret> Example(a, b);
}
public Example(String a, String... b) {}
}