mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 08:51:02 +07:00
[java-inspections] FunctionalExpressionCanBeFolded: disable if qualifier subtype overrides default methods of function
Fixes IDEA-310524 "Method reference can be replaced with qualifier changes" suggestion changes behavior in unwanted ways. (Spring Security) GitOrigin-RevId: f927ab534894188fa418a499c98af3a7c169b0cd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
78a77d064c
commit
5778a45943
@@ -0,0 +1,28 @@
|
||||
// "Fix all 'Functional expression can be folded' problems in file" "true"
|
||||
import java.util.function.Predicate;
|
||||
|
||||
class Test {
|
||||
interface LoggingPredicate extends Predicate<String> {
|
||||
@Override
|
||||
default Predicate<String> negate() {
|
||||
System.out.println("negating!");
|
||||
return Predicate.super.negate();
|
||||
}
|
||||
}
|
||||
|
||||
interface SubPredicate extends Predicate<String> {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
LoggingPredicate predicate = s -> !s.isEmpty();
|
||||
test(predicate::test);
|
||||
Predicate<String> copy = predicate;
|
||||
test(copy::test);
|
||||
SubPredicate subPredicate = s -> !s.isEmpty();
|
||||
test(subPredicate);
|
||||
}
|
||||
|
||||
private static void test(Predicate<String> test) {
|
||||
System.out.println(test.negate().test("hello"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// "Fix all 'Functional expression can be folded' problems in file" "true"
|
||||
import java.util.function.Predicate;
|
||||
|
||||
class Test {
|
||||
interface LoggingPredicate extends Predicate<String> {
|
||||
@Override
|
||||
default Predicate<String> negate() {
|
||||
System.out.println("negating!");
|
||||
return Predicate.super.negate();
|
||||
}
|
||||
}
|
||||
|
||||
interface SubPredicate extends Predicate<String> {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
LoggingPredicate predicate = s -> !s.isEmpty();
|
||||
test(predicate::test);
|
||||
Predicate<String> copy = predicate;
|
||||
test(copy::test);
|
||||
SubPredicate subPredicate = s -> !s.isEmpty();
|
||||
test(subPredicate::<caret>test);
|
||||
}
|
||||
|
||||
private static void test(Predicate<String> test) {
|
||||
System.out.println(test.negate().test("hello"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user