"MINUS_NULL" and the future of explicit nulls

You discarded the using erased NotGiven[Null <:< T] from the other thread but that seems to be a pretty idiomatic way to prevent that T is Null at the type level?

In general, I think Scala current behaviour of allowing put[Null](null) seems to be good design, as an unbounded generic should work with any type. It seems that the intent of @NonNull would be to prevent put[Object](null)which is prevented by default with explicit nulls in Scala.

If you don’t want to allow T to be null, then maybe def put[T <: AnyRef](t: T)would be what you want (or back to the using clause).

Or in other words, to me it seems that @NonNull T is meant to say „for any reference type that you might substitute for T, make sure that the concrete type does not allow for null“. Which is the default for explicit nulls.

Maybe I am not really understanding your usecase. Do you have any examples for behaviours you would like to prevent that are currently not expressible?