15.12.2.1: Consider type parameter declarations for lambda potential compatibility

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P5
    • None
    • Affects Version/s: 8
    • Component/s: specification

      Potential compatibility testing takes into account the arity of the targeted function type, but not the number of type parameters. Specifically, given a lambda argument, it would be possible to treat as incompatible all target function types that are generic. (Per 15.27.3, a lambda is never compatible with a generic function type.)

      Example:

         interface ConsumerA { <T> void accept(int i); }
         interface ConsumerB { void accept(int i); }
         void execute1(ConsumerA c) {}
         void execute1(ConsumerB c) {}

          execute1(x -> {}); // specified ambiguous, but could be disambiguated

            Assignee:
            Unassigned
            Reporter:
            Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: