mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-29 13:48:49 +07:00
IDEA-360860 fixed * split tests into individual methods, to make debugging easier * add javadoc for VariableAccessUtils#isVariableTypeChangeSafeForReference (cherry picked from commit f6b3468079959f7adec737e0b8ec3ad1d97e7ad2) IJ-MR-150176 GitOrigin-RevId: 4b430e49819c7cba1e08ecee47b881f05be570d4
15 lines
420 B
Java
15 lines
420 B
Java
import java.util.Optional;
|
|
|
|
class OptionalIsPresent {
|
|
public void foo() {
|
|
Optional<Object> opt = Optional.ofNullable(Math.random() > 0.5 ? new Object() : null);
|
|
if (<warning descr="Can be replaced with single expression in functional style">opt.isPresent()</warning>) {
|
|
// who dares wins
|
|
Object obj = opt.get();
|
|
use(obj);
|
|
}
|
|
}
|
|
|
|
void use(Object obj) { System.out.println("Object"); }
|
|
}
|