Unsafe and AwkwardStrongEncapsulation

Remi Forax forax at univ-mlv.fr
Fri Nov 4 08:17:57 UTC 2016


Hi Jochen,
the package sun.misc in the module jdk.unsupported is declared open,
do you can use deep reflection on it.

$ javap -m jdk.unsupported module-info
Warning: Binary file module-info contains jdk.unsupported.module-info
Compiled from "module-info.java"
module jdk.unsupported {
  requires java.base;
  exports sun.misc;
  exports com.sun.nio.file;
  exports sun.reflect;
  opens sun.misc;
  opens sun.reflect;
}

cheers,
Rémi

----- Mail original -----
> De: "Jochen Theodorou" <blackdrag at gmx.org>
> À: "jigsaw-dev" <jigsaw-dev at openjdk.java.net>
> Envoyé: Vendredi 4 Novembre 2016 09:05:54
> Objet: Unsafe and AwkwardStrongEncapsulation

> On 04.11.2016 00:32, mark.reinhold at oracle.com wrote:
>> 2016/11/1 14:17:43 -0700, neil.bartlett at paremus.com:
>>> ...
>> In scenarios where a module's author
>> can't foresee the need for such access (e.g., intrusive serialization
>> frameworks) then the framework's author must take more drastic measures
>> (e.g., use the legacy unsupported unsafe API).  This balance is intended
>> to help maintain the integrity of a module as expressed by its author.
> 
> 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?
> 
> bye Jochen


More information about the jigsaw-dev mailing list