JDK-5025117 : javac crashes with annotation element of type Class, default void.class
  • Type: Bug
  • Component: specification
  • Sub-Component: language
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic,solaris_8
  • CPU: generic
  • Submitted: 2004-04-01
  • Updated: 2004-04-01
  • Resolved: 2004-04-01
Related Reports
Duplicate :  
Description
The following source file:

package open;

import java.lang.annotation.*;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;

@Documented @Inherited @Target(TYPE) @Retention(RUNTIME)
public @interface NotificationType {
    String value();				// e.g. "my.notif.type"
    Class userDataClass() default void.class;	// e.g. MemoryNotifInfo.class
}

crashes the current compiler (pre-b46):

javac -source 1.5 NotificationType.java

An exception has occurred in the compiler (1.5.0-internal). 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.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)
	at com.sun.tools.javac.comp.MemberEnter.access$400(MemberEnter.java:39)
	at com.sun.tools.javac.comp.MemberEnter$6.enterAnnotation(MemberEnter.java:709)
	at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:92)
	at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:82)
	at com.sun.tools.javac.comp.Enter.main(Enter.java:394)
	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:382)
	at com.sun.tools.javac.main.Main.compile(Main.java:586)
	at com.sun.tools.javac.main.Main.compile(Main.java:538)
	at com.sun.tools.javac.Main.compile(Main.java:44)
	at com.sun.tools.javac.Main.main(Main.java:35)

The code compiles if void.class is changed into Void.class.

Comments
PUBLIC COMMENTS .
10-06-2004

EVALUATION The current jsr175 requires we accept this but provices no classfile representation for it. ###@###.### 2004-04-01
01-04-2004