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

structural most specific and stuckness

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8, 8-repo-lambda
    • tools
    • b108
    • Verified

      Code like the following:

      static <T,R> Stream<R> map(Stream<T> s, Function<T,R> f);
      static <T> IntStream map(Stream<T> s, ToIntFunction<T> f);
      Stream<String> ss = ...;
      map(ss, s->s.length());

      Doesn't work, as the lambda is 'stuck' during overload resolution, which means both methods will be applicable. In turn, for structural most specific to kick in, we need same parameter types on corresponding functional descriptors, which is not the case here (alpha-renaming).

            vromero Vicente Arturo Romero Zaldivar
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: