Spec confusion about open modules

Cay Horstmann cay.horstmann at sjsu.edu
Sun Jul 2 10:16:31 UTC 2017


In §7.7, the JLS draft from 2017-06-26 states:

An open module, with the open modifier ... grants access at run time to
types in all its packages, as if all packages had been exported.
...
Distinct from access at compile time and access at run time, the Java SE 
Platform provides reflective access via the Core Reflection API (§1.4)...

So, here is my question. I had thought the purpose of open modules and 
opened packages was to be able to access non-public members at runtime 
through reflection.

But it appears from the workding of the JLS as if other runtime access 
would also be possible. Like what? I mean, if I don't have compile-time 
access, what runtime access do I have other than through reflection? 
Synthesized byte codes? Method handles? Or did I overlook something 
really obvious here?

Thanks,

Cay

-- 

Cay S. Horstmann | http://horstmann.com | mailto:cay at horstmann.com


More information about the jigsaw-dev mailing list