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

inference: propagate >> and == constraints to help uninferred type vars

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 7
    • 7
    • specification
    • None
    • rc
    • generic
    • generic
    • Verified

    Description

      JLS 15.12.2.7 generates but does not use supertype constraints of the form S>>T. Such a constraint arises if a formal parameter uses '? super T'. If T is not inferred by 15.12.2.7, then 15.12.2.8 takes over and (in many cases) generates Object>>T. This is not wrong, but is imprecise. There is no reason why the JLS shouldn't propagate the >> constraints from 15.12.2.7 to 15.12.2.8. Also, as per 6650759, it is desirable to propagate == constraints. 15.12.2.8 could say:

      "Then, a set of initial constraints consisting of:
      - the constraint S >> R'...
      - additional constraints Bi[T1=B(T1)..Tn=B(Tn)] >> Ti, where ...
      ***- for any constraint of the form V >> Ti generated in 15.12.2.7: a constraint V[T1=B(T1)..Tn=B(Tn)] >> Ti***
      ***- for any constraint of the form Ti == V generated in 15.12.2.7: a constraint Ti == V[T1=B(T1)..Tn=B(Tn)]***"

      Attachments

        Issue Links

          Activity

            People

              abuckley Alex Buckley
              abuckley Alex Buckley
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: