Javac gets confused with type-inference and crashes with StackOverflowError

Victor Williams Stafusa da Silva victorwssilva at
Sat Jan 23 22:11:42 UTC 2016

Hi, I got a problem with the javac 1.8.0_72 compiler, which resulted in it
crashing with a StackOverflowError (so it is obviosuly a compiler bug).
After some work investigating it, I produced this minimal testcase which
reproduces the problem:

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);

I know that I should report this over the site. However, my
internet is terribly bad and slow today due to some networking problem on
my side and I couldn't post it there.

This javac bug is specially annoying when saving the file with Netbeans 8.1
- The result is that the IDE simply hangs unresponsive forever and I am
forced to kill it in the OS. Netbeans should behave gracefully even in the
event of the compiler crashing miserably, so there is some Netbeans bug
also. I know that this is not the place to report bugs in Netbeans, but I
don't know how/where to report bugs in Netbeans and would take some time
and effort to find it by myself (specially with my internet connection),
and I know that many people in this mailing list would be able to report to
them easily and quickly.

Victor Williams Stafusa da Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the compiler-dev mailing list