mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-22 20:49:52 +07:00
20 lines
575 B
Java
20 lines
575 B
Java
import java.util.Optional;
|
|
|
|
class Test {
|
|
private void checkIsPresent(boolean b) {
|
|
Optional<String> test;
|
|
if (b) {
|
|
test = Optional.of("x");
|
|
} else {
|
|
test = Optional.empty();
|
|
if(<warning descr="Condition '!test.isPresent()' is always 'true'">!test.isPresent()</warning>) {
|
|
System.out.println("Always");
|
|
}
|
|
}
|
|
Optional<String> other = test;
|
|
if(test.isPresent() && <warning descr="Condition 'other.isPresent()' is always 'true' when reached">other.isPresent()</warning>) {
|
|
System.out.println(test.get());
|
|
}
|
|
}
|
|
}
|