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

(ann) {Constructor,Field,Method}.getAnnotation() cache conflicts with RedefineClasses()

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      java.lang.reflect.{Constructor,Field,Method} objects are created with
      annotations data embedded in the object instead of using a JVM entry
      point to fetch the current annotations like java.lang.Class. This is
      effectively a cache of the annotations data since RedefineClasses()
      does not change the annotations data in place. RedefineClasses() attaches
      new annotations data to the class when it is redefined.

      In addition to this implicit cache, there is an explicit cache of objects
      stored in the java.lang.Class object. Some of the elements like Constructors
      and Methods should flushed upon a RedefineClasses() call. Currently fields
      cannot be modified by RedefineClasses(), but that may change in the future.

      Once new JVM entry points similar to JVM_GetClassAnnotations() have been
      added to the VM, then java.lang.reflect.{Constructor,Field,Method} will
      need to be modified to use those entry points. The counter field added by
      6407335 (java.lang.Class.classRedefinedCount) should be used to determine
      when the Constructor,Field,Method} annotations data needs to be refetched.

      Constructor - needs JVM_GetMethodAnnotations() and
                    JVM_GetMethodParameterAnnotations();
                    does not need JVM_GetMethodDefaultAnnotations()
      Field - needs JVM_GetFieldAnnotations()
      Method - needs JVM_GetMethodAnnotations(),
                    JVM_GetMethodDefaultAnnotations, and
                    JVM_GetMethodParameterAnnotations()

      From the VM's point of view, constructors are methods so we should be able
      to use the same entry points.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                dcubed Daniel Daugherty
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Imported:
                  Indexed: