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

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

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 7
    • Fix Version/s: 7
    • Component/s: specification
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      rc
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: