-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
b19
-
generic
-
generic
PreserveAllAnnotations option appears to be a leftover from the original implementation in JDK 1.5 (most likely it was used to assist testing), and there are no signs of its usage.
Description of the option says: "Preserve RuntimeInvisibleAnnotations as well as RuntimeVisibleAnnotations".
If the flag is set classFileParser does not ignore RuntimeInvisibleAnnotations/RuntimeInvisibleTypeAnnotations/RuntimeInvisibleParameterAnnotations attributes, but consider them "RuntimeVisible" (concatenating the annotations with corresponding "RuntimeVisible" annotations).
JVMS (https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-4.html#jvms-4.7.17):
The RuntimeInvisibleAnnotations attribute is similar to the RuntimeVisibleAnnotations attribute (§4.7.16), except that the annotations represented by a RuntimeInvisibleAnnotations attribute must not be made available for return by reflective APIs, unless the Java Virtual Machine has been instructed to retain these annotations via some implementation-specific mechanism such as a command line flag. In the absence of such instructions, the Java Virtual Machine ignores this attribute.
https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-4.html#jvms-4.7.19
contains similar note for RuntimeInvisibleParameterAnnotations.
https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-4.html#jvms-4.7.21
does not contain such note for RuntimeInvisibleTypeAnnotations.
The option is untested and should be be deprecated in 23, obsoleted in 24 and removed in 25.
Description of the option says: "Preserve RuntimeInvisibleAnnotations as well as RuntimeVisibleAnnotations".
If the flag is set classFileParser does not ignore RuntimeInvisibleAnnotations/RuntimeInvisibleTypeAnnotations/RuntimeInvisibleParameterAnnotations attributes, but consider them "RuntimeVisible" (concatenating the annotations with corresponding "RuntimeVisible" annotations).
JVMS (https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-4.html#jvms-4.7.17):
The RuntimeInvisibleAnnotations attribute is similar to the RuntimeVisibleAnnotations attribute (§4.7.16), except that the annotations represented by a RuntimeInvisibleAnnotations attribute must not be made available for return by reflective APIs, unless the Java Virtual Machine has been instructed to retain these annotations via some implementation-specific mechanism such as a command line flag. In the absence of such instructions, the Java Virtual Machine ignores this attribute.
https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-4.html#jvms-4.7.19
contains similar note for RuntimeInvisibleParameterAnnotations.
https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-4.html#jvms-4.7.21
does not contain such note for RuntimeInvisibleTypeAnnotations.
The option is untested and should be be deprecated in 23, obsoleted in 24 and removed in 25.
- csr for
-
JDK-8329808 Deprecate -XX:+PreserveAllAnnotations
- Closed
- relates to
-
JDK-8330427 Obsolete -XX:+PreserveAllAnnotations
- Resolved