Possible bug in javac 8 'legacy' type inference
Vicente-Arturo Romero-Zaldivar
vicente.romero at oracle.com
Fri Nov 15 07:34:56 PST 2013
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/07322115/attachment.html
More information about the compiler-dev
mailing list