org.springframework.core.convert.converter.Converter is in a @NullMarked package, so all types are @NonNull by default.
All uses of T are @Nullable, but the type parameter itself is not. This leads to non-intuitive code such as:
Converter<@NonNull Source, @NonNull Target> converter;
// ...
@Nullable Target t = converter.convert(s);
The convert method itself ends up annotated as @Nullable @NonNull T.
As far as I can see, the solution is to just annotate the parameter declaration, and nothing should break?
public interface Converter<S, @Nullable T> {
org.springframework.core.convert.converter.Converteris in a@NullMarkedpackage, so all types are@NonNullby default.All uses of
Tare@Nullable, but the type parameter itself is not. This leads to non-intuitive code such as:The
convertmethod itself ends up annotated as@Nullable @NonNull T.As far as I can see, the solution is to just annotate the parameter declaration, and nothing should break?