JDK-6422541 : fix for {Constructor,Field,Method} annotation cache and RedefineClasses() conflict needs HS changes
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 6
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-05-05
  • Updated: 2014-09-11
  • Resolved: 2006-06-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b87Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
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.

New JVM entry points similar to JVM_GetClassAnnotations() need to be
added to the VM, then java.lang.reflect.{Constructor,Field,Method} will
need to be modified to use those entry points (see 6422536). 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.
JVM_GetMethodDefaultAnnotations isn't a good choice of method name.
It doesn't return annotations at all, but rather a single annotation element value.
How about JVM_GetMethodDefaultAnnotationValue ?

Comments
SUGGESTED FIX See attached 6422541-webrev-cr0.tgz file for the proposed changes that were sent out for code review round 0.
30-05-2006

EVALUATION The description pretty much says it all.
13-05-2006