3 ms·
What is the purpose of enforcing module boundaries? That appears to be why none of these internal classes will be accessible. Outside of a sandboxed environment
by MichaelGG 11y ago
What is the purpose of enforcing module boundaries? That appears to be why none of these internal classes will be accessible. Outside of a sandboxed environment, who cares what you do? Is it for some magic optimization? Or just some folks on a rampage? (The quote from the guy saying it needs to die, and I read the mailing list, well it seems to be baseless.)
- mike_hearn 11y agoThere are documents and presentations discussing that. Yes, it has a variety of benefits, including security, performance (e.g. a static linker with DCE becomes a lot easier), not exposing internal guts to apps that then come to depend on them, etc. All that said, if you want to disable module enforcement, then they seem to be saying there will be command line switches to do that. Much like there are switches to disable other forms of rule enforcement.
- pjmlp 11y agoOne of the purposes of Jigsaw is offering a way to define a public API based on multiple jar files, similar to what OSGi does. Similar in concept how Assembly Modules work in .NET, with friendly internals, which incidentally not many devs know about. In Java's case a linker will be part of the SDK, so that only the Java code required for a given application will be deployed. Since Oracle needed to clean up dependencies to implement Jigsaw, they are taking the opportunity to also remove most internal APIs, Unsafe being one of them. They are also in the process of replacing JNI with something more programming friendly, P/Invoke style, but it will only come in Java 10. There is also the reason that in a memory safe language every use of JNI and Unsafe is another security bug waiting to happen. If the compiler/runtime are able to offer safe APIs with similar performance, then those exploits can be avoided.