Error messages like 'List<@Nullable String> cannot be assigned to ...' can be confusing, because the annotations (e.g. @Nullable) do not affect Java's type system. It might be clearer to omit the annotations when printing types in diagnostics.
===
import static java.lang.annotation.ElementType.TYPE_USE;
import java.lang.annotation.Target;
import java.util.List;
@Target(TYPE_USE)
@interface A {}
public class T {
List<@A Number> f(List<String> xs) {
return xs;
}
}
===
Actual:
$ javac -fullversion ~/T.java
javac full version "19-ea+33-2224"
T.java:11: error: incompatible types: List<String> cannot be converted to List<@A Number>
return xs;
^
1 error
Suggested:
error: incompatible types: List<String> cannot be converted to List<Number>