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

Add VM support for type annotation reflection

XMLWordPrintable

    • b15
    • Not verified

        JSR-308 brings annotation on type use (as opposed to annotations on type declarations only that we have today).

        From the spec:

        "JSR 308 introduces two new attributes: RuntimeVisibleTypeAnnotations and RuntimeInvisibleTypeAnnotations. These attributes are structurally identical to the RuntimeVisibleAnnotations and RuntimeInvisibleAnnotations attributes described above with one exception: rather than an array of annotation elements, RuntimeVisibleTypeAnnotations and RuntimeInvisibleTypeAnnotations contain an array of type_annotation elements, which are described in Section 3.1.

        Runtime[In]VisibleTypeAnnotations_attribute {
           u2 attribute_name_index; // "Runtime[In]VisibleTypeAnnotation"
           u2 attribute_length;
           u2 num_annotations;
           type_annotation annotations[num_annotations];
        }

        A type annotation is stored in a Runtime[In]visibleTypeAnnotations attribute on the smallest enclosing class, field, or method."

        We need to add support in the VM for storing those TypeAnnotation attributes, and send them to Java-land to be parsed.

              jfranck Joel Borggrén-Franck (Inactive)
              jfranck Joel Borggrén-Franck (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: