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

18.2: Clarify that some constraints should never be encountered

    XMLWordPrintable

Details

    Description

      For completeness, 18.2 prescribes a "false" result for the reduction of certain constraints that should never be encountered by a compiler. These all involve non-proper types appearing in certain parts of a lambda's or method ref's target type.

      In these cases, a clarifying comment would be useful.

      ---
      18.2.1

      If the lambda expression is implicitly typed and one or more of the function type's parameter types is not a proper type, the constraint reduces to false.

      ***This condition never arises in practice, due to the handling of implicitly-typed lambda expressions in 18.5.1 and the substitution applied to the target type in 18.5.2.***

      ...

      If one or more of the function type's parameter types is not a proper type, the constraint reduces to false.

      ***This condition never arises in practice, due to the handling of inexact method references in 18.5.1 and the substitution applied to the target type in 18.5.2.***

      ---
      18.2.5

      Otherwise, if the lambda expression is implicitly typed, and one or more of the function type's parameter types is not a proper type, the constraint reduces to false.

      Otherwise, if the function type's return type is neither void nor a proper type, the constraint reduces to false.

      ***The previous two conditions never arise in practice, due to the substitution applied to the target type in 18.5.2.***

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: