Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8037039

18.2.4: Do not generate a bound of the form alpha=<null type>

    XMLWordPrintable

Details

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              abuckley Alex Buckley
              dlsmith Dan Smith
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: