mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-09 08:09:39 +07:00
If we cannot determine the non-nullity of map expression, then info level is used. Fixes IDEA-172609 "Replace Optional.isPresent() checks with functional-style expressions" is broken.
13 lines
466 B
Java
13 lines
466 B
Java
// "Replace Optional.isPresent() condition with functional style expression" "INFORMATION"
|
|
|
|
import java.util.Optional;
|
|
import java.util.function.Function;
|
|
import java.util.function.Supplier;
|
|
|
|
public class Main {
|
|
|
|
public void test(Optional<String> opt, Function<String, Object> onPresent, Supplier<Object> onEmpty) {
|
|
// information level: could be semantic change if onPresent returns null
|
|
Object o = opt.map(onPresent::apply).orElseGet(onEmpty::get);
|
|
}
|
|
} |