Skip to content
Permalink
Browse files
8236225: Remove expired flags in JDK 17
8256717: Expire the long term obsoleted VM flags

Reviewed-by: coleenp, kvn
  • Loading branch information
David Holmes committed Dec 16, 2020
1 parent 4d6f318 commit 1e77896838e15c334c9f5e0eaa17c23b321b5ca8
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -84,7 +84,7 @@ typedef enum {
JMM_INTERNAL_ATTRIBUTE_INDEX = 100,
JMM_CLASS_LOADED_BYTES = 101, /* Number of bytes loaded instance classes */
JMM_CLASS_UNLOADED_BYTES = 102, /* Number of bytes unloaded instance classes */
JMM_TOTAL_CLASSLOAD_TIME_MS = 103, /* Accumulated VM class loader time (TraceClassLoadingTime) */
JMM_TOTAL_CLASSLOAD_TIME_MS = 103, /* Accumulated VM class loader time */
JMM_VM_GLOBAL_COUNT = 104, /* Number of VM internal flags */
JMM_SAFEPOINT_COUNT = 105, /* Total number of safepoints */
JMM_TOTAL_SAFEPOINTSYNC_TIME_MS = 106, /* Accumulated time spent getting to safepoints */
@@ -518,7 +518,6 @@ static SpecialFlag const special_jvm_flags[] = {
{ "MaxRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
{ "MinRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
{ "InitialRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
{ "UseMembar", JDK_Version::jdk(10), JDK_Version::jdk(12), JDK_Version::undefined() },
{ "AllowRedefinitionToAddDeleteMethods", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() },
{ "FlightRecorder", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() },
{ "CriticalJNINatives", JDK_Version::jdk(16), JDK_Version::jdk(17), JDK_Version::jdk(18) },
@@ -537,42 +536,9 @@ static SpecialFlag const special_jvm_flags[] = {
{ "TLABStats", JDK_Version::jdk(12), JDK_Version::undefined(), JDK_Version::undefined() },

// -------------- Obsolete Flags - sorted by expired_in --------------
{ "PermSize", JDK_Version::undefined(), JDK_Version::jdk(8), JDK_Version::undefined() },
{ "MaxPermSize", JDK_Version::undefined(), JDK_Version::jdk(8), JDK_Version::undefined() },
{ "SharedReadWriteSize", JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
{ "SharedReadOnlySize", JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
{ "SharedMiscDataSize", JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
{ "SharedMiscCodeSize", JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
#ifdef BSD
{ "UseBsdPosixThreadCPUClocks", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "UseOprofile", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
#ifdef ASSERT
{ "DummyObsoleteTestFlag", JDK_Version::undefined(), JDK_Version::jdk(17), JDK_Version::undefined() },
#endif
{ "PrintVMQWaitTime", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "UseNewFieldLayout", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "UseSemaphoreGCThreadsSynchronization", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "ForceNUMA", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "InitialBootClassLoaderMetaspaceSize", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "UseLargePagesInMetaspace", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "InsertMemBarAfterArraycopy", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "Debugging", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "UseRDPCForConstantTableBase", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "VerifyMergedCPBytecodes", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "PrintSharedSpaces", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "TraceBiasedLocking", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "TraceClassLoading", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "TraceClassLoadingPreorder", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "TraceClassPaths", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "TraceClassResolution", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "TraceClassUnloading", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "TraceExceptions", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "TraceInvokeDynamic", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "TraceLoaderConstraints", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "TraceMethodHandles", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "TraceMonitorInflation", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "TraceSafepointCleanupTime", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "TraceJVMTIObjectTagging", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "TraceRedefineClasses", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "PrintJNIResolving", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) },

#ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
// These entries will generate build errors. Their purpose is to test the macros.
@@ -22,7 +22,7 @@
.\"t
.\" Automatically generated by Pandoc 2.3.1
.\"
.TH "JAVA" "1" "2020" "JDK 16" "JDK Commands"
.TH "JAVA" "1" "2020" "JDK 17" "JDK Commands"
.hy
.SH NAME
.PP
@@ -181,7 +181,7 @@ with new values added and old values removed.
You\[aq]ll get an error message if you use a value of \f[I]N\f[R] that is
no longer supported.
The supported values of \f[I]N\f[R] are the current Java SE release
(\f[CB]16\f[R]) and a limited number of previous releases, detailed in the
(\f[CB]17\f[R]) and a limited number of previous releases, detailed in the
command\-line help for \f[CB]javac\f[R], under the \f[CB]\-\-source\f[R] and
\f[CB]\-\-release\f[R] options.
.RE
@@ -1120,72 +1120,6 @@ Updates \f[I]module\f[R] to open \f[I]package\f[R] to
.RS
.RE
.TP
.B \f[CB]\-\-illegal\-access=\f[R]\f[I]parameter\f[R]
When present at run time, \f[CB]\-\-illegal\-access=\f[R] takes a keyword
\f[I]parameter\f[R] to specify a mode of operation:
.RS
.RS
.PP
\f[B]Note:\f[R] This option will be removed in a future release.
.RE
.IP \[bu] 2
\f[CB]permit\f[R]: This mode opens each package in each module in the
run\-time image to code in all unnamed modules ( such as code on the
class path), if that package existed in JDK 8.
This enables both static access, (for example, by compiled bytecode, and
deep reflective access) through the platform\[aq]s various reflection
APIs.
The first reflective\-access operation to any such package causes a
warning to be issued.
However, no warnings are issued after the first occurrence.
This single warning describes how to enable further warnings.
This mode is the default for the current JDK but will change in a future
release.
.IP \[bu] 2
\f[CB]warn\f[R]: This mode is identical to \f[CB]permit\f[R] except that a
warning message is issued for each illegal reflective\-access operation.
.IP \[bu] 2
\f[CB]debug\f[R]: This mode is identical to \f[CB]warn\f[R] except that both
a warning message and a stack trace are issued for each illegal
reflective\-access operation.
.IP \[bu] 2
\f[CB]deny\f[R]: This mode disables all illegal\-access operations except
for those enabled by other command\-line options, such as
\f[CB]\-\-add\-opens\f[R].
This mode will become the default in a future release.
.PP
The default mode, \f[CB]\-\-illegal\-access=permit\f[R], is intended to
make you aware of code on the class path that reflectively accesses any
JDK\-internal APIs at least once.
To learn about all such accesses, you can use the \f[CB]warn\f[R] or the
\f[CB]debug\f[R] modes.
For each library or framework on the class path that requires illegal
access, you have two options:
.IP \[bu] 2
If the component\[aq]s maintainers have already released a fixed version
that no longer uses JDK\-internal APIs then you can consider upgrading
to that version.
.IP \[bu] 2
If the component still needs to be fixed, then you can contact its
maintainers and ask them to replace their use of JDK\-internal APIs with
the proper exported APIs.
.PP
If you must continue to use a component that requires illegal access,
then you can eliminate the warning messages by using one or more
\f[CB]\-\-add\-opens\f[R] options to open only those internal packages to
which access is required.
.PP
To verify that your application is ready for a future version of the
JDK, run it with \f[CB]\-\-illegal\-access=deny\f[R] along with any
necessary \f[CB]\-\-add\-opens\f[R] options.
Any remaining illegal\-access errors will most likely be due to static
references from compiled code to JDK\-internal APIs.
You can identify those by running the \f[B]jdeps\f[R] tool with the
\f[CB]\-\-jdk\-internals\f[R] option.
For performance reasons, the current JDK does not issue warnings for
illegal static\-access operations.
.RE
.TP
.B \f[CB]\-\-limit\-modules\f[R] \f[I]module\f[R][\f[CB],\f[R]\f[I]module\f[R]...]
Specifies the limit of the universe of observable modules.
.RS
@@ -3937,6 +3871,68 @@ future JDK release.
They\[aq]re still accepted and acted upon, but a warning is issued when
they\[aq]re used.
.TP
.B \f[CB]\-\-illegal\-access=\f[R]\f[I]parameter\f[R]
When present at run time, \f[CB]\-\-illegal\-access=\f[R] takes a keyword
\f[I]parameter\f[R] to specify a mode of operation:
.RS
.RS
.PP
\f[B]Note:\f[R] This option will be removed in a future release.
.RE
.IP \[bu] 2
\f[CB]permit\f[R]: This mode opens each package in each module in the
run\-time image to code in all unnamed modules ( such as code on the
class path), if that package existed in JDK 8.
This enables both static access, (for example, by compiled bytecode, and
deep reflective access) through the platform\[aq]s various reflection
APIs.
The first reflective\-access operation to any such package causes a
warning to be issued.
However, no warnings are issued after the first occurrence.
This single warning describes how to enable further warnings.
.IP \[bu] 2
\f[CB]warn\f[R]: This mode is identical to \f[CB]permit\f[R] except that a
warning message is issued for each illegal reflective\-access operation.
.IP \[bu] 2
\f[CB]debug\f[R]: This mode is identical to \f[CB]warn\f[R] except that both
a warning message and a stack trace are issued for each illegal
reflective\-access operation.
.IP \[bu] 2
\f[CB]deny\f[R]: This mode disables all illegal\-access operations except
for those enabled by other command\-line options, such as
\f[CB]\-\-add\-opens\f[R].
This mode is the default.
.PP
If your application does not work with the default mode of
\f[CB]\-\-illegal\-access=deny\f[R] then you can learn more about what is
going on with the \f[CB]warn\f[R] and \f[CB]debug\f[R] modes.
For each library or framework on the class path that requires illegal
access, you have two options:
.IP \[bu] 2
If the component\[aq]s maintainers have already released a fixed version
that no longer uses JDK\-internal APIs then you can consider upgrading
to that version.
.IP \[bu] 2
If the component still needs to be fixed, then you can contact its
maintainers and ask them to replace their use of JDK\-internal APIs with
the proper exported APIs.
.PP
If you must continue to use a component that requires illegal access,
then you can eliminate the warning messages by using one or more
\f[CB]\-\-add\-opens\f[R] options to open only those internal packages to
which access is required.
.PP
To verify that your application is ready for a future version of the
JDK, run it with \f[CB]\-\-illegal\-access=deny\f[R] along with any
necessary \f[CB]\-\-add\-opens\f[R] options.
Any remaining illegal\-access errors will most likely be due to static
references from compiled code to JDK\-internal APIs.
You can identify those by running the \f[B]jdeps\f[R] tool with the
\f[CB]\-\-jdk\-internals\f[R] option.
For performance reasons, the current JDK does not issue warnings for
illegal static\-access operations.
.RE
.TP
.B \f[CB]\-Xfuture\f[R]
Enables strict class\-file format checks that enforce close conformance
to the class\-file format specification.
@@ -4006,6 +4002,52 @@ The default value is 2.
Use the option \f[CB]\-XX:MinRAMPercentage\f[R] instead.
.RE
.TP
.B \f[CB]\-XX:+UseBiasedLocking\f[R]
Enables the use of biased locking.
Some applications with significant amounts of uncontended
synchronization may attain significant speedups with this flag enabled,
but applications with certain patterns of locking may see slowdowns.
.RS
.PP
By default, this option is disabled.
.RE
.SH OBSOLETE JAVA OPTIONS
.PP
These \f[CB]java\f[R] options are still accepted but ignored, and a
warning is issued when they\[aq]re used.
.PP
None in JDK 17.
.SH REMOVED JAVA OPTIONS
.PP
These \f[CB]java\f[R] options have been removed in JDK 17 and using them
results in an error of:
.RS
.PP
\f[CB]Unrecognized\ VM\ option\f[R] \f[I]option\-name\f[R]
.RE
.TP
.B \f[CB]\-XX:+UseMembar\f[R]
Enabled issuing membars on thread\-state transitions.
This option was disabled by default on all platforms except ARM servers,
where it was enabled.
.RS
.RE
.TP
.B \f[CB]\-XX:MaxPermSize=\f[R]\f[I]size\f[R]
Sets the maximum permanent generation space size (in bytes).
This option was deprecated in JDK 8 and superseded by the
\f[CB]\-XX:MaxMetaspaceSize\f[R] option.
.RS
.RE
.TP
.B \f[CB]\-XX:PermSize=\f[R]\f[I]size\f[R]
Sets the space (in bytes) allocated to the permanent generation that
triggers a garbage collection if it\[aq]s exceeded.
This option was deprecated in JDK 8 and superseded by the
\f[CB]\-XX:MetaspaceSize\f[R] option.
.RS
.RE
.TP
.B \f[CB]\-XX:+TraceClassLoading\f[R]
Enables tracing of classes as they are loaded.
By default, this option is disabled and classes aren\[aq]t traced.
@@ -4053,62 +4095,13 @@ The replacement Unified Logging syntax is
\f[CB]\-Xlog:class+loader+constraints=info\f[R].
See \f[B]Enable Logging with the JVM Unified Logging Framework\f[R].
.RE
.TP
.B \f[CB]\-XX:+UseBiasedLocking\f[R]
Enables the use of biased locking.
Some applications with significant amounts of uncontended
synchronization may attain significant speedups with this flag enabled,
but applications with certain patterns of locking may see slowdowns.
.RS
.PP
By default, this option is disabled.
.RE
.SH OBSOLETE JAVA OPTIONS
.PP
These \f[CB]java\f[R] options are still accepted but ignored, and a
warning is issued when they\[aq]re used.
.TP
.B \f[CB]\-XX:+UseMembar\f[R]
Enabled issuing membars on thread\-state transitions.
This option was disabled by default on all platforms except ARM servers,
where it was enabled.
.RS
.RE
.TP
.B \f[CB]\-XX:MaxPermSize=\f[R]\f[I]size\f[R]
Sets the maximum permanent generation space size (in bytes).
This option was deprecated in JDK 8 and superseded by the
\f[CB]\-XX:MaxMetaspaceSize\f[R] option.
.RS
.RE
.TP
.B \f[CB]\-XX:PermSize=\f[R]\f[I]size\f[R]
Sets the space (in bytes) allocated to the permanent generation that
triggers a garbage collection if it\[aq]s exceeded.
This option was deprecated in JDK 8 and superseded by the
\f[CB]\-XX:MetaspaceSize\f[R] option.
.RS
.RE
.SH REMOVED JAVA OPTIONS
.PP
These \f[CB]java\f[R] options have been removed in JDK 15 and using them
results in an error of:
.RS
.PP
\f[CB]Unrecognized\ VM\ option\f[R] \f[I]option\-name\f[R]
.RE
.TP
.B \f[CB]\-XX:+UseParallelOldGC\f[R]
Enables the use of the parallel garbage collector for full GCs.
By default, this option is disabled.
Enabling it automatically enables the \f[CB]\-XX:+UseParallelGC\f[R]
option.
.RS
.RE
.PP
For the lists and descriptions of options removed in previous releases
see the \f[I]Removed Java Options\f[R] section in:
.IP \[bu] 2
\f[B]Java Platform, Standard Edition Tools Reference, Release 16\f[R]
[https://docs.oracle.com/en/java/javase/16/docs/specs/man/java.html]
.IP \[bu] 2
\f[B]Java Platform, Standard Edition Tools Reference, Release 15\f[R]
[https://docs.oracle.com/en/java/javase/15/docs/specs/man/java.html]
.IP \[bu] 2
@@ -4794,6 +4787,10 @@ T}
.TE
.SS Convert Runtime Logging Flags to Xlog
.PP
These legacy flags are no longer recognized and will cause an error if
used directly.
Use their unified logging equivalent instead.
.PP
.TS
tab(@);
lw(15.0n) lw(20.2n) lw(34.7n).
@@ -27,6 +27,7 @@
* @summary Newly obsolete command line options should still give useful error messages when used improperly.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @requires vm.debug == true
* @run driver ObsoleteFlagErrorMessage
*/

@@ -36,20 +37,22 @@
public class ObsoleteFlagErrorMessage {
public static void main(String[] args) throws Exception {

String flag = "DummyObsoleteTestFlag";

// Case 1: Newly obsolete flags with extra junk appended should not be treated as newly obsolete (8060449)
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:UseMembarPlusJunk", "-version");
"-XX:" + flag + "PlusJunk", "-version");

OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("Unrecognized VM option 'UseMembarPlusJunk'"); // Must identify bad option.
output.shouldContain("Unrecognized VM option '" + flag + "PlusJunk'"); // Must identify bad option.
output.shouldHaveExitValue(1);

// Case 2: Newly obsolete flags should be recognized as newly obsolete (8073989)
ProcessBuilder pb2 = ProcessTools.createJavaProcessBuilder(
"-XX:+UseMembar", "-version");
"-XX:+" + flag, "-version");

OutputAnalyzer output2 = new OutputAnalyzer(pb2.start());
output2.shouldContain("Ignoring option").shouldContain("support was removed");
output2.shouldContain("UseMembar");
output2.shouldContain(flag);
}
}
Loading

1 comment on commit 1e77896

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 1e77896 Dec 16, 2020

Please sign in to comment.