Hi

Having recently started looking into the JDK9-jigsaw builds, and the
numerous changes that it entails, to see what impact it has on our
software, I have some initial questions that I haven't been able to
find the answers to so far.

1) There have been some discussions on this mailing list already
regarding escaping the encaptulation of the modules, but I haven't
found anything regarding what the best/recommended practice is for
something like profilers, trace advices, etc or anything else that
instruments classes throughout the system, inserting calls to methods
to perform various tasks.
In JDK8, adding this using a javaagent, my classes were on the boot
classpath, thus accessible to the entire system. But this is no longer
the case in jigsaw -- so how am I supposed to do this in a module-aware
system?
Am I just supposed to hack into the module system, to add edges from
every single module in the system to my agent? While that is doable,
it doesn't sounds very nice, requiring poking a lot of holes using
reflection to bypass the "in-same-module" checks etc.
These kind of instrumentations are not that uncommon in the Java
ecosystem, so I assume there must have been some considerations how
this should be accompliced?
Or is there no recommended way for doing this?

2) Why the backwards-incompatible change to getResourceAsStream
family of methods? Sure, the methods are binary compatible, but
behave very differently than previously!
Object.class.getResourceAsStream("Object.class") now returns null,
apparently just for the sake of it, as the InputStream can easily
be obtained from the Module, without any in-same-module checks, via:
Object.class.getModule().getResourceAsStream("java/lang/Object.class")
But, accessing this through the Module requires the code to be
compiled against JDK9, having to keep multiple different codepaths in
the code depending on which JDK version I'm loading the resources on!

3) Why was the implementation of java.lang.Package changed, so it no
longer returns the content of the Manifest file?
Previously, doing MyClass.class.getPackage().getImplementationTitle()
would return the "Implementation-Title" entry from the manifest file,
but now it returns null instead.
The documentation in JDK8 even mentions that this information is
typically stored in the manifest, where as the JDK9 now states that
these values are unspecified.


Best regards
Michael Rasmussen
ZeroTurnaround

Reply via email to