The following code will break the compiler and gives bug file request message.
Here there are two attributes are being and declared with same elements and was trying to use one in others place and got a compiler crash.
public @interface TestM2 {
String message() default "MyMessage";
Class myClass() default Integer.class;
}
public @interface TestM3 {
String message() default "MyMessage";
Class myClass() default Integer.class;
}
class BadClass implements TestM3 {
public String message() {
return "Hello World";
}
public Class myClass() {
return Float.TYPE;
}
public static void main(String[] arg) {
System.out.println(" Done...");
BadClass bc = new BadClass();
TestM2 tm2 = (TestM2) bc;
System.out.println(" "+tm2.message());
System.out.println(" "+tm2.myClass());
}
}
This still occurs with build 32a. To reproduce:
Put into 3 files, TestM2.java, TestM3.java, BadClass.java
Compile twice as
javac -source 1.5 TestM2.java BadClass.java
javac -source 1.5 TestM2.java BadClass.java
An exception has occurred in the compiler (1.5.0-auto-tiger). Please file a bug at the Java Develope
r Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicat
es. Include your program and the following diagnostic in your report. Thank you.
java.lang.AssertionError
at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxy(ClassReader.java:994)
at com.sun.tools.javac.jvm.ClassReader$AnnotationDefaultCompleter.enterAnnotation(ClassReade
r.java:1083)
...
###@###.### 2004-01-10
Here there are two attributes are being and declared with same elements and was trying to use one in others place and got a compiler crash.
public @interface TestM2 {
String message() default "MyMessage";
Class myClass() default Integer.class;
}
public @interface TestM3 {
String message() default "MyMessage";
Class myClass() default Integer.class;
}
class BadClass implements TestM3 {
public String message() {
return "Hello World";
}
public Class myClass() {
return Float.TYPE;
}
public static void main(String[] arg) {
System.out.println(" Done...");
BadClass bc = new BadClass();
TestM2 tm2 = (TestM2) bc;
System.out.println(" "+tm2.message());
System.out.println(" "+tm2.myClass());
}
}
This still occurs with build 32a. To reproduce:
Put into 3 files, TestM2.java, TestM3.java, BadClass.java
Compile twice as
javac -source 1.5 TestM2.java BadClass.java
javac -source 1.5 TestM2.java BadClass.java
An exception has occurred in the compiler (1.5.0-auto-tiger). Please file a bug at the Java Develope
r Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicat
es. Include your program and the following diagnostic in your report. Thank you.
java.lang.AssertionError
at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxy(ClassReader.java:994)
at com.sun.tools.javac.jvm.ClassReader$AnnotationDefaultCompleter.enterAnnotation(ClassReade
r.java:1083)
...
###@###.### 2004-01-10
- duplicates
-
JDK-4966228 javac allows incorrect type for complex annotations
- Closed
-
JDK-4972034 compiler crashes with old version class files.
- Closed
-
JDK-4974751 compiler crashes when you use compound attribute
- Closed