mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-03 00:29:58 +07:00
GitOrigin-RevId: 0b3a0065217879ca2ee2d70ee5fec2c41dba7bae
20 lines
494 B
Java
20 lines
494 B
Java
import org.jspecify.annotations.NullMarked;
|
|
import org.jspecify.annotations.Nullable;
|
|
import org.jspecify.annotations.NonNull;
|
|
|
|
@NullMarked
|
|
public class Nullness {
|
|
interface Decoder<T extends @Nullable Object> {
|
|
@NonNull T decode(Object o);
|
|
}
|
|
|
|
static <T extends @Nullable Object> Decoder<T> identity(T value) {
|
|
return __ -> /*ca-nullable-to-not-null*/value;
|
|
}
|
|
|
|
public static void main() {
|
|
Integer i = 3;
|
|
Decoder<Integer> d = identity(i);
|
|
int j = d.decode(i);
|
|
}
|
|
} |