mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-24 17:51:09 +07:00
25 lines
659 B
Java
25 lines
659 B
Java
// "Replace with <>" "false"
|
|
class XYZ {
|
|
@Target({ElementType.TYPE_USE, ElementType.METHOD})
|
|
public @interface Nullable {}
|
|
|
|
public final static class Wrapper<T> {
|
|
private final T value;
|
|
|
|
public Wrapper(T value) {
|
|
this.value = value;
|
|
}
|
|
}
|
|
@Nullable
|
|
public static String getString() {
|
|
return ThreadLocalRandom.current().nextBoolean() ? "hello" : null;
|
|
}
|
|
|
|
public static <T> void genericConsumer(T item) {}
|
|
|
|
public static void main(String[] args) {
|
|
genericConsumer(new Wrapper<@Nullable<caret>s String>(getString()));
|
|
// below one works great
|
|
Wrapper<@Nullable String> wrapper = new Wrapper<>(getString());
|
|
}
|
|
} |