FULL PRODUCT VERSION :
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When using nested annotation types, after changing the name of one of the parameters in an annotation type an assertion error fails in the compiler. See the source.
This bug is probably related to 5065421.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the two java files in the test case. Then in CompilerAnnotationTest2 change parameter name2 to name3. Then recompile, keeping the old class files in tact. Not changing CompilerAnnotationTest
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Compiler gives a compiler error.
ACTUAL -
Compiler crashes.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
C:\>javac CompilerAnnotationTest2.java
An exception has occurred in the compiler (1.5.0). Please file a bug at the Java
Developer Connection (http://java.sun.com/webapps/bugreport) after checking th
e Bug Parade for duplicates. Include your program and the following diagnostic i
n your report. Thank you.
java.lang.AssertionError: cannot find method CompilerAnnotationTest2.name2()
at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.findAccessMetho
d(ClassReader.java:1074)
at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxyCompound
(ClassReader.java:1057)
at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.visitCompoundAn
notationProxy(ClassReader.java:1151)
at com.sun.tools.javac.jvm.ClassReader$CompoundAnnotationProxy.accept(Cl
assReader.java:1019)
at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxy(ClassRe
ader.java:1084)
at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.visitArrayAttri
buteProxy(ClassReader.java:1145)
at com.sun.tools.javac.jvm.ClassReader$ArrayAttributeProxy.accept(ClassR
eader.java:1004)
at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxy(ClassRe
ader.java:1084)
at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxyCompound
(ClassReader.java:1058)
at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxyCompound
List(ClassReader.java:1046)
at com.sun.tools.javac.jvm.ClassReader$AnnotationCompleter.enterAnnotati
on(ClassReader.java:1195)
at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:94)
at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:86)
at com.sun.tools.javac.comp.Enter.complete(Enter.java:473)
at com.sun.tools.javac.comp.Enter.main(Enter.java:426)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:382)
at com.sun.tools.javac.main.Main.compile(Main.java:592)
at com.sun.tools.javac.main.Main.compile(Main.java:544)
at com.sun.tools.javac.Main.compile(Main.java:58)
at com.sun.tools.javac.Main.main(Main.java:48)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
//CompilerAnnotationTest.java
@CompilerAnnotationTest(@CompilerAnnotationTest2(name="test",name2="test2"))
public @interface CompilerAnnotationTest
{
CompilerAnnotationTest2[] value();
}
//CompilerAnnotationTest2.java
@CompilerAnnotationTest(@CompilerAnnotationTest2(name="test"))
@interface CompilerAnnotationTest2
{
String name();
String name2() default "test"; //compile and change this to name3, then recompile
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
remove old class files, or recompile all sources together
###@###.### 2005-1-07 00:21:06 GMT