Unsafe and AwkwardStrongEncapsulation
Alan Bateman
Alan.Bateman at oracle.com
Fri Nov 4 08:12:01 UTC 2016
On 04/11/2016 08:05, Jochen Theodorou wrote:
> Since Unsafe was mentioned here... All the ways I did know to get to
> Unsafe required reflection on private members. Afaik
> #AwkwardStrongEncapsulation will block that. So how can I still use
> Unsafe in the future or did it get some "proper" public way to get
> hold of an Unsafe by now and I missed that?
I think you are looking for JEP 260 [1]. The critical internal APIs
where it lists the "critical internal APIs" that are not encapsulated in
JDK 9. If you are using the Jigsaw EA builds then look at `java
--list-modules jdk.unsupported` where you'll see that sun.misc (and
sun.reflect) are both exported and open.
-Alan
[1] http://openjdk.java.net/jeps/260
More information about the jigsaw-dev
mailing list