nr: #3 dodano: 2017-01-03 16:01
Scala specification section 3.5.2 (conformance) states (emphasis mine):
<: relation forms pre-order between types, i.e. it is
transitive and reflexive. least upper bounds and greatest lower bounds
of a set of types are understood to be relative to that order.
So if we look at the type constructor declaration from a mathematical point of view, we see the
:< relation as:
Null <: T <: Any
Since by definition the relation is reflexive,
Null <: Null is in the relation, which makes null a valid value to be passed into the method.
As @sepp2k rightly said in the comments and in his answer, the fact that
A isn't constrained by an upper bound means that
Any is a valid candidate, which means a null value could be passed anyway.