Files
Tagir Valeevandintellij-monorepo-bot 985b752fad Avoid inlining lambdas not from local scope
When lambda is defined in the outer scope a number of problems may appear during the analysis. First, it actually could be analyzed twice producing different warnings (in inlining context, and as standalone expression). Second, trap-handling assumes that all exited expressions should appear within the current codeFragment. This could be violated when lambda comes from the outer scope, resulting in incorrect jumps.

Fixes IDEA-240328 Condition always false inspection is wrong if using switch expressions

GitOrigin-RevId: 11794502d2e661044fa2105402955aa54e3c1245
2020-05-12 04:34:42 +00:00

12 lines
287 B
Java

import java.util.function.Predicate;
class SwitchExpr {
void test() {
Predicate<String> predicate = value -> switch(value) {
case "A" -> true;
default -> false;
};
Predicate<String> otherPredicate = value -> value.length() == 1 && predicate.test(value);
}
}