JDK-5021870 : void.class crashes compiler
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2004-03-27
  • Updated: 2004-04-09
  • Resolved: 2004-04-09
Related Reports
Duplicate :  
Description

Name: ss24420			Date: 03/26/2004


Compiling this code:

    @interface A {
	Class value() default void.class;
    }

leads to:

    An exception has occurred in the compiler (1.5.0-beta2).
    Please file a bug...
    java.lang.NullPointerException
	at com.sun.tools.javac.code.Types.erasure(Types.java:1722)
	at com.sun.tools.javac.code.Symbol$ClassSymbol.erasure(Symbol.java:561)
	at com.sun.tools.javac.code.Attribute$Class.makeClassType(Attribute.java:61)
	at com.sun.tools.javac.code.Attribute$Class.<init>(Attribute.java:57)
	at com.sun.tools.javac.comp.Annotate.enterAttributeValue(Annotate.java:195)
	at com.sun.tools.javac.comp.MemberEnter.enterDefaultValue(MemberEnter.java:721)
        ...


ClassSymbol.erasure(Types) makes the assumption that type.outer() isn't
null.  It is null in this case.  (Who'd have thought we'd be erasing void?)


======================================================================