mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-08 21:52:48 +07:00
GitOrigin-RevId: 681c23757e1be9f8fc26fd23cb23ae90385fb8a8
14 lines
637 B
Java
14 lines
637 B
Java
import java.util.stream.*;
|
|
import org.jetbrains.annotations.*;
|
|
|
|
class Test {
|
|
public static void main(String... args) {
|
|
// Stream.of("elvis") gets Stream<@NotNull String> type, as "elvis" is not null. As reduce() doesn't introduce a new type parameter,
|
|
// we have a warning here.
|
|
String res = Stream.of("elvis").reduce(<warning descr="Passing 'null' argument to parameter annotated as @NotNull">null</warning>, (a, b) -> b);
|
|
|
|
if (<warning descr="Condition 'res.equals(\"elvis\")' is always 'true'">res.equals("elvis")</warning>) {}
|
|
|
|
String res2 = Stream.<@Nullable String>of("elvis").reduce(null, (a, b) -> b);
|
|
}
|
|
} |