JDK-6874250 : Mixup between binary names and descriptors in Runtime*Annotations attributes
  • Type: Bug
  • Component: specification
  • Sub-Component: vm
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2009-08-20
  • Updated: 2014-02-26
  • Resolved: 2011-07-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 rcFixed
Related Reports
Relates :  
Description
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.

Comments
EVALUATION A spec change to mention descriptors in both cases is in order.
20-08-2009