javac 8/9 inconsistency

Anna Kozlova anna.kozlova at
Tue Feb 17 12:59:45 UTC 2015

Hi Maurizio,
Test::factory is not exact, correct? Then when return type constraint is added, T has only one lower bound, so  doesn’t apply as is. What can it be then?
BTW I found more inconsistencies between 8/9 in our testdata, should I file them?
From: Maurizio Cimadamore [mailto:maurizio.cimadamore at] 
Sent: Tuesday, February 17, 2015 12:05 PM
To: Anna Kozlova; compiler-dev at
Subject: Re: javac 8/9 inconsistency
Hi Anna,
I remember now - this is indeed:

That problem was ultimately caused by an ambiguity in the spec - which is why the fix was targeted for 9 and hasn't been backported. I would say it's normal for these kind of spec-related fixes to target the next release and not being backported.

On 16/02/15 19:27, Maurizio Cimadamore wrote:
Hi Anna,
it looks like the test should compile - I'm not sure as to which bugs are involved, I'll take a closer look and let you know.

On 16/02/15 17:45, Anna Kozlova wrote:
The following code compiles with java 9 (b. 49) but doesn’t with 8 (1.8u40 b.23)
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