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

18.5.2: Do not eagerly resolve when inference variables are in lower bounds

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • specification

      If the return type of a method is α, 18.5.2 says it should be immediately resolved in order to allow for capture. The specific condition:

      "B2 contains two bounds of the forms S1 <: α and S2 <: α, where S1 and S2 have supertypes that are two different parameterizations of the same generic class or interface"

      This fails to consider (or is at least ambiguous about) the possibility that S1 or S2 can be _inferred_ to be the same parameterization of the same type. E.g., 'C<String> <: α' and 'C<β> <: α'.

      This check is a heuristic; the simplest way to relax it in order to permit cases like the above is by asserting that S1 and S2 are proper types.

            dlsmith Dan Smith
            dlsmith Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: