JDK-8129882 : Improve consistency of HotSpot-specific annotations
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9,10
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2015-06-25
  • Updated: 2018-11-05
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.
Other
tbdUnresolved
Related Reports
Relates :  
Description
Currently, the HotSpotVM looks for a set of per-method annotations so that it can treat these methods specially later on. These annotations are:

sun_reflect_CallerSensitive_signature
java_lang_invoke_ForceInline_signature
java_lang_invoke_DontInline_signature
java_lang_invoke_InjectedProfile_signature
java_lang_invoke_LambdaForm_Compiled_signature
java_lang_invoke_LambdaForm_Hidden_signature
jdk_internal_HotSpotIntrinsicCandidate_signature
java_lang_invoke_Stable_signature
sun_misc_Contended_signature

There are two problems with these annotations:

Problem 1:

All annotations are specific to the HotSpot VM but they are located in four different classes. To improve the consistency of the JDK codebase, it would be good it all annotations were located in the same package.

Problem 2:

The annotations are likely to not be useful for anyone except the HotSpot VM, but all annotations have RetentionPolicy.Runtime. A more appropriate annotation type could be RetentionPolicy.Class.

The reason for retention policy Runtime for these classes is the way the HotSpot VM currently processes annotations. Annotations not visible at runtime are already "gone" by the time the above-listed special annotations are processed and their presence is noted by the VM (in ClassFileParser::AnnotationCollector::annotation_index). It would be good to change the VM to process special annotations earlier (or to retain them until a later point at class loading) and then also change the retention policy of all the above-listed classes to Class.