Summary
Change the default value of the command line option --sun-misc-unsafe-memory-access
from allow
to warn
. A warning is printed to standard error on the first occasion that any memory-access method in sun.misc.Unsafe
is used.
Problem
JEP 471 introduced --sun-misc-unsafe-memory-access={allow|warn|debug|deny}
, which controls the runtime behavior of sun.misc.Unsafe
's memory-access methods, with the default value of allow
.
The next step in the roadmap is to change the default value of the option from allow
to warn
. A future JEP and CSR will propose to change the default value to deny
.
Solution
Change the default value of the command line option --sun-misc-unsafe-memory-access
to warn
. This is the equivalent of running with --sun-misc-unsafe-memory-access=warn
. A warning is printed to standard error on the first occasion that any memory-access method is used.
The warning can be suppressed in this release by running with --sun-misc-unsafe-memory-access=allow
.
Developers can prepare for the future by testing with --sun-misc-unsafe-memory-access=deny
.
Specification
There are no specification changes.
The output from java -X
for the command line option changes to:
--sun-misc-unsafe-memory-access=<value>
allow or deny usage of unsupported API sun.misc.Unsafe
<value> is one of "allow", "warn", "debug", or "deny".
The default value is "warn".
- csr of
-
JDK-8342380 Implement JEP 498: Warn upon Use of Memory-Access Methods in sun.misc.Unsafe
-
- Resolved
-
- relates to
-
JDK-8331686 Deprecate the Memory-Access Methods in sun.misc.Unsafe for Removal
-
- Closed
-