JSObjectLinker questions
Attila Szegedi
attila.szegedi at oracle.com
Mon May 6 00:20:51 PDT 2013
No, you haven't gotten it wrong at all. NashornLinker should be public. This change was a product of an over-eager clampdown of the public surface of our API. I'll look into fixing this.
Actually, we have a bit of an access-related conundrum even if I make it public. Namely, as we integrated Dynalink, we put it into the jdk.internal.dynalink package. NashornLinker itself lives in jdk.nashorn.internal.runtime.linker package. Both jdk.internal.* and jdk.nashorn.internal.* packages are access-restricted. This isn't an issue if you're not running with a SecurityManager, but with SecurityManager, your code creating the linker will have to have the relevant accessClassInPackage permission. Is that an obstacle in your case? (It's only an obstacle if you both use SecurityManager and can't grant the permission to your framework code. I don't really think it should be an obstacle, just wanted to make sure you're aware of it.)
If it isn't an obstacle, then simply making the class public should be sufficient for your purposes. If it is, then we have bigger problems, as your code won't be able to interface with internalized Dynalink at all. We'll then need to discuss further with various OpenJDK parties if we can ship Dynalink in a way that is not endorsed, but not restricted either (right now, jdk.internal is both non-endorsed and restricted code).
Attila.
On May 3, 2013, at 5:50 PM, Peter Zhelezniakov <Peter.Zhelezniakov at oracle.com> wrote:
> On 04/16/2013 05:20 PM, Attila Szegedi wrote:
>> I'd suggest you just assemble your own DynamicLinker using your own factory; probably just put "new NashornLinker()" into the list of prioritized linkers and nothing else (you probably don't need the other linkers in Nashorn's internal prioritized linker list - they're only needed when linking call sites in a JavaScript program).
>>
>> Then you can have your own bootstrap() and createDynamicInvoker() calls that delegate to your own DynamicLinker.
>
> I cannot do "new NashornLinker()" as NashornLinker is package-private. Is there some other way to obtain an instance?
>
> (I recall from your J1 presentation that NashornLinker was designed to be publicly reusable, as opposed to NashornPrimitiveLinker, or have I got it wrong?)
>
> Thanks!
> --
> Peter | x33066 | St Petersburg, Russia | timezone: GMT+04
More information about the nashorn-dev
mailing list