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

The tag 'I' is emitted in place of 'B' for annotation members of type byte

XMLWordPrintable

    • b35
    • generic
    • generic

      The compiler appears to be emitting the tag 'I' for annotation member values of type byte in place of the specified tag 'B'. This can be seen by looking at the class file for the followin program:

      import static java.lang.annotation.VisibilityLevel.RUNTIME;
      import java.lang.annotation.*;

      @Foo(17) public class Junk {
          public static void main(String[] args) {
              System.out.println(Junk.class.getAnnotation(Foo.class).value());
          }
      }

      @Visibility(RUNTIME) @interface Foo {
          byte value();
      }

      Similarly, it looks like 'I' is being emitted in place of 'S' for short, in place of 'C' for char, and in place of 'Z' for boolean.

      Finally, it looks like 'I' is being emitted in place of J for long *defaults*. This is particularly serious, as it results in information loss.

      ###@###.### 2003-12-05

            gafter Neal Gafter (Inactive)
            jjb Josh Bloch
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: