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.
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.
- relates to
-
JDK-6986662 (ann) ClassLoader RuntimeVisibleAnnotations lost after RedefineClasses
-
- Open
-
-
JDK-5002251 potential bug with annotations and class file evolution
-
- Resolved
-
-
JDK-6412391 fix for annotation cache and RedefineClasses() conflict needs HotSpot changes
-
- Resolved
-
-
JDK-6422541 fix for {Constructor,Field,Method} annotation cache and RedefineClasses() conflict needs HS changes
-
- Resolved
-
-
JDK-6407335 (ann) java.lang.Class.getAnnotation() cache conflicts with RedefineClasses()
-
- Resolved
-