Files
Bas Leijdekkers d85933d67d Java: don't warn about replacing type with diamond on nested annotation (IDEA-288000)
GitOrigin-RevId: 16c913b812b81538d5587432e9bed3af5b586545
2025-01-17 18:10:29 +00:00

25 lines
658 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> String>(getString()));
// below one works great
Wrapper<@Nullable String> wrapper = new Wrapper<>(getString());
}
}