Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7141054

Clarify element_value structure for annotation attributes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 8
    • 7
    • specification
    • vm
    • x86
    • windows_7
    • Verified

    Description

      FULL PRODUCT VERSION :
      N/A

      ADDITIONAL OS VERSION INFORMATION :
      Irrelevant (maybe you should update bugs.sun.com so that it stops telling me I can't report under 'Generic/other'? Half of the bug sections are not OS-specific in the first place!

      A DESCRIPTION OF THE PROBLEM :
      Section 4.7.16.1 of the JVM Specification explains how annotations are encoded in the class file.

      For the 'class_info_index' section, the example lists, and I quote:

      the type that is reified by the
      class represented by this element_value structure (e.g., ‘V’
      for Void.class, ‘Ljava/lang/Object;’ for Object, etc.)


      This example is wrong; the typo is 'Void.class'. This should be 'void.class' (lowercase v!).

      void.class becomes 'V'.

      Void.class becomes 'Ljava/lang/Void'.


      For thoroughness I've double-checked and both javac7 and ecj get it right and produce 'Ljava/lang/Void;' for @Foo(value=Void.class) and not 'V'.


      Solution: Fix the typo.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      @Foo(void.class)
      public class Test {}

      @interface Foo {
          Class<?> value();
      }

      ---------- END SOURCE ----------

      Attachments

        Activity

          People

            abuckley Alex Buckley
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: