javac 8/9 inconsistency

Anna Kozlova anna.kozlova at
Mon Feb 16 17:45:56 UTC 2015

The following code compiles with java 9 (b. 49) but doesn't with 8 (1.8u40
class Test<K> {
    public static void foo(Test<String> test) {
        Test<String> e = create(Test::factory, test);
    private static <T> T create(Supplier<T> callback, T defaultVal) {
        return null;
    static <P> Test<P> factory() {
        return null;
What is correct? 
BTW I've found which
explains to me the situation with  Test<String> e = create(() -> factory(),
test); but the fix version is 9. Would it be backported to java 8?
Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the compiler-dev mailing list