javac rejects valid java 7 code
Vicente-Arturo Romero-Zaldivar
vicente.romero at oracle.com
Tue May 6 17:15:34 UTC 2014
Hi Anna,
This bug has been fixed in both 9 and 8 dev repos.
Thanks,
Vicente
On 21/11/13 17:43, Dan Smith wrote:
> On Nov 18, 2013, at 8:31 AM, Anna Kozlova <Anna.Kozlova at jetbrains.com> wrote:
>
>> This code compiles with java 1.7 (also 1.6) but fails to compile with 1.8
>> (b. 115)
>>
>>
>>
>> abstract class A2<T>{
>>
>> abstract <S> S foo(S x, S y);
>>
>> abstract <S1> void baz(A2<S1> a)
>>
>>
>>
>> void bar(A2<Integer> y, A2<Long> x){
>>
>> baz(foo(x, y));
>>
>> }
>>
>> }
> Thanks for this example. It illustrates a design flaw: inference in 8 supports capture on a nested method's return type (see Lambda Spec, Part G, 18.5.2), but only when the return type is a parameterized type. As this example illustrates, it may also be necessary to perform capture when the return type is an inference variable (which can be instantiated to a parameterized type).
>
> I've created a bug:
> https://bugs.openjdk.java.net/browse/JDK-8028800
>
> —Dan
>
>
More information about the lambda-dev
mailing list