-
Bug
-
Resolution: Fixed
-
P4
-
8, 9
-
b23
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8064056 | 8u45 | Vicente Arturo Romero Zaldivar | P4 | Resolved | Fixed | b01 |
JDK-8049512 | 8u40 | Vicente Arturo Romero Zaldivar | P4 | Resolved | Fixed | b08 |
JDK-8070276 | emb-8u47 | Vicente Arturo Romero Zaldivar | P4 | Resolved | Fixed | team |
javac apparently does some partial checking of lambda bodies in nested invocations during overload resolution, and uses the results to consider some methods inapplicable. This is incorrect -- the nested lambda body should not influence applicability at all.
<T> T apply(UnaryOperator<T> op, T arg) { return op.apply(arg); }
class B { B x() { return this; } }
class C {}
void m(B arg) { System.out.println("B"); }
void m(C arg) { System.out.println("C"); }
m(apply(arg -> arg.x(), null)); // ambiguous, as expected
m(apply(arg -> new B(), null)); // expected: ambiguous; actual: chooses m(B)
(I believe this is a holdover from earlier overload resolution prototypes, which were designed to make use of partial information in the lambda body.)
<T> T apply(UnaryOperator<T> op, T arg) { return op.apply(arg); }
class B { B x() { return this; } }
class C {}
void m(B arg) { System.out.println("B"); }
void m(C arg) { System.out.println("C"); }
m(apply(arg -> arg.x(), null)); // ambiguous, as expected
m(apply(arg -> new B(), null)); // expected: ambiguous; actual: chooses m(B)
(I believe this is a holdover from earlier overload resolution prototypes, which were designed to make use of partial information in the lambda body.)
- backported by
-
JDK-8049512 Should ignore nested lambda bodies during overload resolution
-
- Resolved
-
-
JDK-8064056 Should ignore nested lambda bodies during overload resolution
-
- Resolved
-
-
JDK-8070276 Should ignore nested lambda bodies during overload resolution
-
- Resolved
-
- duplicates
-
JDK-8033677 Compiler fails to perform type-inference for a lambda passed to a generic method
-
- Closed
-
- relates to
-
JDK-8079630 generic method call passed as varargs argument regression
-
- Closed
-