Files
openide/java/java-tests/testData/inspection/dataFlow/fixture/StreamAnyMatchIsNull.java
T
2019-08-05 03:03:37 +03:00

22 lines
549 B
Java

import java.math.BigInteger;
import java.util.Objects;
import java.util.stream.Stream;
import org.jetbrains.annotations.Nullable;
class Test {
@Nullable
BigInteger calculate(@Nullable Boolean first, @Nullable BigInteger second, @Nullable BigInteger third) {
if (Stream.of(first, second, third).anyMatch(Objects::isNull)) {
return null;
}
return (first ? second : BigInteger.ZERO).add(third);
}
void simpler(@Nullable Boolean b) {
Object x = b;
if (x != null) {
System.out.println(b.hashCode());
}
}
}