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> {
Comment From: sdeleuze
I think it makes sense to refine T to allow flexible type-level nullability, so it would be declared as public interface Converter<S, ? extends @Nullable T>. I will give it a try and see how it goes.