[java-inspections] LambdaCanBeMethodReference: disable conversion in many cases when cast is required

Fixes IDEA-267865 Add a option for Java's method reference inspection that ignore lambda which can't convert into method reference without a cast

GitOrigin-RevId: b6f762383d6ba1ef19a5de36e0ad53d107ba4e80
This commit is contained in:
Tagir Valeev
2021-10-08 18:36:11 +07:00
committed by intellij-monorepo-bot
parent 9f3d7463a1
commit bcb843dd8f
7 changed files with 43 additions and 51 deletions

View File

@@ -1,6 +1,5 @@
// "Replace with forEach" "true"
import java.util.function.UnaryOperator;
import java.util.stream.Stream;
public class Main {
@@ -12,6 +11,6 @@ public class Main {
static boolean isGood(A a) {}
public long test() {
Stream.iterate(new A(), (UnaryOperator<A>) Main::isGood, a -> a.next()).filter(a -> a.x < 3).forEach(System.out::println);
Stream.iterate(new A(), a -> isGood(a), a -> a.next()).filter(a -> a.x < 3).forEach(System.out::println);
}
}