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

4.5: Capture to check well-formedness of a parameterized type may be undefined

    Details

      Description

      The following parameterized type should be considered malformed:

      class C<T extends Number> {}
      C<? extends String> test;

      This is sort of implied by 4.5, but could be more clear.

      Specifically, well-formedness relies on capturing C<? extends String> and then checking that the capture variable is a subtype of Number. Capture, in turn, performs glb(String, Number), with this stipulation (5.1.10):

      "It is a compile-time error if, for any two classes (not interfaces) Vi and Vj, Vi is not a subclass of Vj or vice versa."

      In other words, in 4.5, the capture of C<T1,...,Tn> may be undefined. It would be helpful to call this out as a possible condition under which the type C<T1,...,Tn> may be considered malformed.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dlsmith Dan Smith
                Reporter:
                dlsmith Dan Smith
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: