Qualified exports/opens and services
Nicolai Parlog
nipa at codefx.org
Thu Jan 4 22:14:56 UTC 2018
Hi Alan, David,
thanks for your replies, both are very helpful! :)
so long ... Nicolai
On 04.01.2018 16:06, Alan Bateman wrote:
> On 04/01/2018 14:25, David Lloyd wrote:
>> : Hi Nicolai,
>>
>> You may want to refer to the thread here:
>> http://mail.openjdk.java.net/pipermail/jigsaw-dev//2017-November/013315.html
>>
>>
>>
>>
Essentially a module may delegate a private Lookup to itself, or a
>> module may do so on behalf of another module. To use your
>> example, the module called "jpa" would have to internally create
>> a private Lookup on "com.example.dto" and hand it over to the
>> "hibernate" module, which would then be able to use it to reflect
>> on private members of "com.example.dto".
> I suspect Nicolai is looking for Module addOpens:
>
> "API Note: This method can be used for cases where a consumer
> module uses a qualified opens to open a package to an API module
> but where the reflective access to the members of classes in the
> consumer module is delegated to code in another module. Code in the
> API module can use this method to open the package in the consumer
> module to the other module."
>
> but you are right that using Lookup objects would work well here.
> No need to open any package, instead have the consumer module pass
> a Lookup object as a capability to the framework, the framework
> passes to the trusted service provider.
>
>>
>> That said, the java.lang.invoke.MethodHandles#privateLookupIn()
>> method leaves a little to be desired as it requires a class from
>> the target module; it would be nice if there was a variant which
>> accepted a Module...
> There wouldn't be a lookup class in that case so it would be a
> different kinda of lookup object.
>
> -Alan
>
--
PGP Key:
http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509
Web:
http://codefx.org
a blog about software development
https://www.sitepoint.com/java
high-quality Java/JVM content
http://do-foss.de
Free and Open Source Software for the City of Dortmund
Twitter:
https://twitter.com/nipafx
More information about the jigsaw-dev
mailing list