You are right Peter, that does work. I assumed that the module to which a package was opened automatically received the access rights for any lookup object, thanks for pointing it out to me. This makes my proposal of C obsolete.
I hope that D and E are considered nevertheless! Also, thank you Volker for forwarding this to the correct mailinglists. 2018-01-07 17:40 GMT+01:00 Peter Levart <[email protected]>: > Hi Rafael, > > On 01/07/18 13:10, Volker Simonis wrote: > > At a result, even with Java 9 being supported by many popular frameworks, a > migration away from internal APIs has not yet been achieved. I would > therefore like to suggest the following extensions: > > C) When a module opens a package, other modules should gain package access > to this package when creating method handle lookups. This way, if a user > opens a package containing Spring beans to the Spring framework, it could > proxy all of these beans as it does today. Since opening a package also > permits reflection on package-private types and methods of this package, > this is not a security concern either. > > > Have you checked the new JDK 9 method: > java.lang.invoke.MethodHandles#privateLookupIn > ? > > I believe it should do the trick. > > Regards, Peter > >
