As already noted, A >: Null allows A be Null itself, but that doesn't even matter. Even if A to be a strict supertype of Null , it would still be possible to pass Null to f , since Null is a valid value for these types (which follows directly from the fact that Null is a subtype of them).
If you do not want to accept types with a null value, A must be a subtype of AnyVal . Note that this will prevent the passing of any value of reference types, not just Null .
Cannot accept reference types without accepting null.
source share