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

18.5.2: Consider lambdas appearing as nested invocation arguments

XMLWordPrintable

    • Verified

      18.5.2 considers all implicit lambdas and inexact method references that appear as arguments to the invocation (and were not checked during overload resolution). But it ignores lambdas and method references appearing in nested invocations.

      The full set of constraints should include constraints on both immediate and nested invocation arguments.

      Example:
      <T,R> R apply(Function<T,R> f, T arg) { return f.apply(arg); }
      int i = apply(a1 -> a1.length(), apply(a2 -> a2.getMessage(), new RuntimeException("foo")));
      // should compile successfully: a2 has type RuntimeException; a1 has type String

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

              Created:
              Updated:
              Resolved: