-
Bug
-
Resolution: Fixed
-
P5
-
8
An equality constraint of the form "alpha = <null type>" reduces to a bound of the same form, per 18.2.4. Resolution has the invariant that <null type> is never produced, so it is incorrect to produce bounds involving <null type>.
Suggested fix:
-----
- If S and T are proper types, the constraint reduces to true if S is the same as T (4.3.4), and false otherwise.
- ***Otherwise, if S or T is the null type, the constraint reduces to false.***
- Otherwise, if S is an inference variable, α, the constraint reduces to the bound α = T.
- Otherwise, if T is an inference variable, α, the constraint reduces to the bound S = α.
- Otherwise, ...
-----
Fortunately, I don't believe it is currently possible to reach this point with <null type> (equality constraints usually come from type arguments, and <null type> cannot be a type argument), so this fix is purely about future-proofing and avoiding confusion.
Suggested fix:
-----
- If S and T are proper types, the constraint reduces to true if S is the same as T (4.3.4), and false otherwise.
- ***Otherwise, if S or T is the null type, the constraint reduces to false.***
- Otherwise, if S is an inference variable, α, the constraint reduces to the bound α = T.
- Otherwise, if T is an inference variable, α, the constraint reduces to the bound S = α.
- Otherwise, ...
-----
Fortunately, I don't believe it is currently possible to reach this point with <null type> (equality constraints usually come from type arguments, and <null type> cannot be a type argument), so this fix is purely about future-proofing and avoiding confusion.
- relates to
-
JDK-8033407 18.2.3: 'null' should never be an inference variable bound
- Closed