-
Bug
-
Resolution: Fixed
-
P2
-
None
-
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
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
- relates to
-
JDK-8038747 18.5.2: Consider lambdas appearing as nested invocation arguments inside other lambdas
-
- Closed
-