JDK-8069545 : javac, shouldn't check nested stuck lambdas during overload resolution
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8,9
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2015-01-20
  • Updated: 2017-05-17
  • Resolved: 2015-02-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u60Fixed 9 b51Fixed
Related Reports
Blocks :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
While attributing this test case:

class Test {

    interface Function<X, Y> {
        Y m(X x);
    }

    interface Box<T> {
        T get();
        <R> R map(Function<T,R> f);
    }

    static class Person {
        Person(String name) { }
    }

    void print(Object arg) { }
    void print(String arg) { }

    void test() {
        Box<String> b = null;
        print(b.map(s -> new Person(s)));
    }
}

javac "unsticks" the implicit lambda during overload resolution, thus selecting method print(Object) as applicable. This is incorrect, method print(String) should be the one selected.