On 04.11.2016 09:12, Alan Bateman wrote:
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
I see
module jdk.unsupported {
exports sun.misc;
exports sun.reflect;
exports com.sun.nio.file;
}
That won´t get me access to private fields and constructors in Unsafe
with AwkwardStrongEncapsulation, right? So I see exported, but I don´t
know what you mean with "open" here. I thought we do not have open
modules yet... if we have, I missed the way to declare them and what
they now actually do.
bye Jochen