Summary
Deprecate -XX:+PreserveAllAnnotations option.
Problem
This option appears to be a leftover from the initial implementation of JSR-175 in JDK 1.5 (most likely it was used to assist testing), and there are no signs of its usage. This option is untested and should be deprecated in 23, obsoleted in 24 and removed in 25.
Solution
Deprecate in JDK 23, make obsolete in 24 and remove in 25.
Specification
diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp
index ecd3f00cbeb..69e0809fc54 100644
--- a/src/hotspot/share/runtime/arguments.cpp
+++ b/src/hotspot/share/runtime/arguments.cpp
@@ -501,6 +501,7 @@ static SpecialFlag const special_jvm_flags[] = {
{ "RequireSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
{ "UseSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
{ "RegisterFinalizersAtInit", JDK_Version::jdk(22), JDK_Version::jdk(23), JDK_Version::jdk(24) },
+ { "PreserveAllAnnotations", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
#if defined(X86)
{ "UseRTMLocking", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
{ "UseRTMDeopt", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
index 575d9a3de36..dc61b5f7990 100644
--- a/src/hotspot/share/runtime/globals.hpp
+++ b/src/hotspot/share/runtime/globals.hpp
@@ -799,7 +799,7 @@ const int ObjectAlignmentInBytes = 8;
"at this time") \
\
product(bool, PreserveAllAnnotations, false, \
- "Preserve RuntimeInvisibleAnnotations as well " \
+ "(Deprecated) Preserve RuntimeInvisibleAnnotations as well " \
"as RuntimeVisibleAnnotations") \
\
develop(uintx, PreallocatedOutOfMemoryErrorCount, 4, \
- csr of
-
JDK-8329636 Deprecate -XX:+PreserveAllAnnotations
- Resolved