Bug report: JavaScript arrays are not coerced into Java arrays when calling Java functions that expect arrays

Tal Liron tal.liron at threecrickets.com
Tue Oct 8 12:02:57 PDT 2013


Until he follows up, here's how I *think* it works from looking at the code:

Argument conversion is handled by GuardingTypeConverterFactory 
instances. In Nashorn, these are NashornLinker and NashornPrimitiveLinker.

Custom converters are loaded with a ServiceLoader, and thus can be 
defined in 
META-INF/services/jdk.internal.dynalink.linker.GuardingDynamicLinker. If 
any of those instances also implement GuardingTypeConverterFactory, then 
they are added to the converter chain.

But I have to say that beyond that the code is hard to follow... 
conversion is actually handled with dynamic links so it's somewhat 
"meta" programming at that stage. I'm also unclear as to which converter 
is selected if multiple are available...

Any tips towards helping me find a solution to my issue would be 
appreciated. Indeed, a simple skeleton for a custom linker would be great!

On 10/08/2013 09:04 PM, Jim Laskey (Oracle) wrote:
> You could always create your own Dynalink linker plug in to do the wrappers you need.  Sundar will follow up.
>



More information about the nashorn-dev mailing list