Crashing javac

Eric | April 18, 2008

As I am preparing to hold COMP 520 in Fall, I just read through Michael Schwarzbach’s excellent new version of this lecture. He has one set of exercises on name resolution containing this funny example:

public class java {
    public class lang {
        public class Object {}
    }
}

Give this code to javac and it will bail on you:

mucuna /tmp $ javac java.java
An exception has occurred in the compiler (1.6.0_05). Please file a bug at the
Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking
the Bug Parade for duplicates. Include your program and the following diagnostic
in your report.  Thank you.
java.lang.NullPointerException
at com.sun.tools.javac.comp.Flow.visitIdent(Flow.java:1214)
at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:1547)

Funny, eh?

Comments
Comments Off on Crashing javac
Categories
Research
Tags
bugs, Java, name resolution, type checking