Possible bug in javac 8 'legacy' type inference
Vicente-Arturo Romero-Zaldivar
vicente.romero at oracle.com
Fri Nov 15 08:44:03 PST 2013
On 15/11/13 16:07, Liam Miller-Cushon wrote:
> Thanks Vicente,
>
> If it ends up being a javac 7 bug, this might still be a good thing to
> document for SE 8.
Sure, I will add some notes in the bug description.
Thanks,
Vicente
>
> Liam
>
>
> On Fri, Nov 15, 2013 at 7:34 AM, Vicente-Arturo Romero-Zaldivar
> <vicente.romero at oracle.com <mailto:vicente.romero at oracle.com>> wrote:
>
> Hi Liam,
>
> Thanks for your report, this needs more research but in any case I
> think that if the legacy type inference in javac 8 doesn't yield
> the same result as javac 7 we have a bug in javac 7 or in javac 8
> simulation of javac 7 type inference. So I have created bug entry
> [1] to track this issue.
>
> Vicente.
>
> [1] https://bugs.openjdk.java.net/browse/JDK-8028442
>
>
> On 14/11/13 17:31, Liam Miller-Cushon wrote:
>> The following program compiles with javac 7, and with javac 8
>> using -source 8.
>>
>> However, when compiled with javac 8 and -source 7 an inference
>> error is reported:
>>
>> incompatible types: inference variable T#1 has incompatible upper
>> bounds Message<T#2>,Result
>> Result result = getThing(key);
>> ^
>> where T#1,T#2 are type-variables:
>> T#1 extends Message<T#1> declared in method <T#1>getThing(Key)
>> T#2 extends Result
>>
>>
>> Is this a bug, or is javac 8 more accurately reflecting the
>> intent of JLS 15.12.2.7/15.12.2.8 <http://15.12.2.7/15.12.2.8>?
>>
>> ===
>>
>> class Message<T extends Message<T>> {}
>> class Key extends Message<Key> {}
>> class Result extends Message<Result> {}
>>
>> abstract class Foo {
>> abstract <T extends Message<T>> T getThing(Key key);
>>
>> void test(Key key) {
>> Result result = getThing(key);
>> }
>> }
>>
>> ===
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20131115/8a307f25/attachment.html
More information about the compiler-dev
mailing list