- 
    Bug 
- 
    Resolution: Fixed
- 
     P4 P4
- 
    7
- 
        rc
- 
        generic
- 
        generic
- 
        Verified
                    JVMS3 4.7.16 and 4.7.16.1 describe how type names are stored in the ClassFile attributes for annotations. (The JVMS3 text is taken from http://java.sun.com/docs/books/jvms/second_edition/ClassFileFormat-Java5.pdf)
[4.7.16] annotations.element_value_pairs[].element_name_index points to a CONSTANT_Utf8_info representing "the name of the annotation type element".
[4.7.16.1] annotations.element_value_pairs[].element_value.enum_const_value.type_name_index points to a CONSTANT_Utf8_info representing "the internal form of the binary name (§4.2.1) of the type of the enum constant represented by this element_value structure."
In both cases, javac emits a descriptor for the CONSTANT_Utf8_info. This is overkill, since only class/interface names can possibly appear as the name of an annotation type or an enum constant, and class/interface names can be fully encoded with just a binary name. But what javac writes does appear to agree with what java.lang.reflect.Class.getAnnotations() reads.
            
[4.7.16] annotations.element_value_pairs[].element_name_index points to a CONSTANT_Utf8_info representing "the name of the annotation type element".
[4.7.16.1] annotations.element_value_pairs[].element_value.enum_const_value.type_name_index points to a CONSTANT_Utf8_info representing "the internal form of the binary name (§4.2.1) of the type of the enum constant represented by this element_value structure."
In both cases, javac emits a descriptor for the CONSTANT_Utf8_info. This is overkill, since only class/interface names can possibly appear as the name of an annotation type or an enum constant, and class/interface names can be fully encoded with just a binary name. But what javac writes does appear to agree with what java.lang.reflect.Class.getAnnotations() reads.
- relates to
- 
                    JDK-8020068 Clarify attribute descriptions -           
- Closed
 
-