Extending java.base module
weijun.wang at oracle.com
Wed Feb 15 08:51:56 UTC 2017
Disclaimer: I am not a jigsaw expert.
The provides/uses mechanism is certainly more formal, but you can also
On 02/15/2017 04:36 PM, Langer, Christoph wrote:
> Hi Jigsaw experts,
> as you might or might not know, we have an own JDK implementation with some extension code that is quite interwoven with the jdk.
> Now I'm looking into how this coding can be spread into a good module structure for jdk9. And I'm not a crack yet on using the module system though I've read quite a bit into the spec documentation available so far;-)
> The first point for me is that we have to place some of our coding in the java.base module as we used to add private fields and methods to basic classes such as java.lang.Thread or java.lang.Exception. However, I don't want to have so much of our stuff in java.base and rather think that it should live in its own module. So the question here is if it is possible to call code of other modules from java.base, e.g. via the Service Provider interface? I see that I can define a service in java.base and specify some "uses" statement in module-info. But will my implementation of such a service from other modules be available to java.base?
> Also I'm contemplating about this requirement: I have a class which I would need somewhere in java.base but I'd also like to export it in the public API of my own extension module. So, if I create the class in java.base, I'm not allowed to export this class publicly, unqualified, right? But when I have it living in my extension module, then java.base would not see it. What can I do? Probably create some inherited class in my extension module that extends from the java.base impl and export this??
> I'm hoping that those are easy questions for you and you can give me some helpful answers.
> Thanks a lot in advance!!
> Best regards
More information about the jigsaw-dev