Javac gets confused with type-inference and crashes with StackOverflowError

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Sun Jan 24 21:46:02 UTC 2016


Hi Victor,
thanks for the report; I did some testing and it seems to be a duplicate 
(although with slightly different stack trace) of this:

https://bugs.openjdk.java.net/browse/JDK-8130304

There was an issue in the Tarjan implementation for computing 
topological sort of inference variables; when the bug occurred, 
inference would fail in unexpected ways; in your example it seems like 
the output of the topological sorted inference graph still contained 
loops (which should never occur) - hence the SSO.

Unfortunately the Tarjan classes changed a bit during 9, the backport 
might be hard. We will take a look to see if the fix can be backported 
safely.

Thanks
Maurizio


On 23/01/16 22:11, Victor Williams Stafusa da Silva wrote:
> public class JavaBug {
>
>     public JavaBug() {
>         TestZ r = null;
>         Crazy<String, String> x = r.m3("X");
>         r.m1(r.m4(r.m2(x, r.m3("a")), t -> "x"), r.m3("a"));
>     }
> }
>
> interface Crazy<A, B> {
> }
>
> interface TestZ {
>     public <A, B> Crazy<A, B> m1(Crazy<A, ? extends B>... d);
>     public <A, B, C> Crazy<A, Crazy<B, C>> m2(Crazy<A, B> e, Crazy<A, 
> C> f);
>     public <A> Crazy<A, A> m3(A g);
>     public <A, B, C> Crazy<A, C> m4(Crazy<A, B> h, 
> java.util.function.Function<B, C> i);
> }
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20160124/22186cbb/attachment.html>


More information about the compiler-dev mailing list