type inference regression related to JDK-8157149
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Mon Oct 17 17:36:22 UTC 2016
I'll take a look - thanks for the report.
Maurizio
On 17/10/16 17:14, Liam Miller-Cushon wrote:
> javac started rejecting the following program between 9-ea+119 and
> 9-ea+120. The culprit appears to be JDK-8157149 [1][2]. Was this
> intentional?
>
> Thanks,
>
> [1] https://bugs.openjdk.java.net/browse/JDK-8157149
> <https://bugs.openjdk.java.net/browse/JDK-8157149>
> [2] http://hg.openjdk.java.net/jdk9/dev/langtools/rev/a8b7c9938b74
> <http://hg.openjdk.java.net/jdk9/dev/langtools/rev/a8b7c9938b74>
>
> === Test.java
> abstract class Test {
> interface W<A> {}
> abstract <B> B f(W<B> e);
> abstract <C> C g(C b, long i);
>
> void h(W<Long> i) {
> g("", f(i));
> }
> }
> ===
>
> $ javac Test.java
> ...
> error: method g in class Test cannot be applied to given types;
> g("", f(i));
> ^
> required: C,long
> found: String,Long
> reason: cannot infer type-variable(s) C,B
> (argument mismatch; B cannot be converted to long)
> where C,B are type-variables:
> C extends Object declared in method <C>g(C,long)
> B extends Object declared in method <B>f(W<B>)
> 1 error
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20161017/f98d4b9c/attachment-0001.html>
More information about the compiler-dev
mailing list