3 ms·
Yes, those restrictions were turned on by default at runtime starting in JDK 16 (and at compile-time starting in JDK 9), but they specifically did not include U
by pron 2y ago
Yes, those restrictions were turned on by default at runtime starting in JDK 16 (and at compile-time starting in JDK 9), but they specifically did not include Unsafe [1] precisely because it's been widely used for capabilities for which there were no supported replacements.
Capabilities requiring access to other internals -- such as jdk.compiler/com.sun.tools.javac.api -- do not have supported replacements as they can violate the specification in ways that the specification exists to prevent.
[1]: https://openjdk.org/jeps/260#Critical-internal-APIs-not-encapsulated-in-JDK-9 https://openjdk.org/jeps/260#Critical-internal-APIs-not-enca...