don't suggest to replace annotated type elements with diamond (IDEA-207586)

This commit is contained in:
Bas Leijdekkers
2019-02-23 19:14:13 +01:00
parent 7042612210
commit 767bf19c4a
2 changed files with 31 additions and 1 deletions
@@ -0,0 +1,25 @@
// "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());
}
}