Re: Register a custom type converter (is it possible)?

2016-06-20 Thread Paulo Lopes
r m = new java.util.HashMap(); > > m.putAll({ foo: 44 }); > > var l = new java.util.ArrayList(); > > l.addAll([44, 546, 676]); > > -Sundar > > On 6/20/2016 5:43 PM, Paulo Lopes wrote: > > Hi, > > > > > > I've been reading the documentation, wiki and the e

Register a custom type converter (is it possible)?

2016-06-20 Thread Paulo Lopes
Hi, I've been reading the documentation, wiki and the examples from Nashorn and have a question that I cannot find a yes/no answer to. Say for example that I've an application that leverages on Nashorn for JavaScript execution but its core is in Java. In my Java code I've a interface like:

dynalink alternative for jdk8

2016-10-28 Thread Paulo Lopes
Hi everyone, I'm working with eclipse vert.x project javascript support and one thing we would like to achieve was to simplify our bindings code by having what could be done with dynalink to provide "automatic" conversion between: JSObject <--> io.vertx.core.json.JsonObject We do not want to

Can we define a method name alias when using a Java object/class form Nashorn?

2017-03-09 Thread Paulo Lopes
Hi, For the Vert.x project I've created a simple Promise implementation as available in a Browser. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise I've then played with babel to transpile the ES7 async - await to Promises and I must say that it works

Re: how to help with ES6 features

2017-04-27 Thread Paulo Lopes
lnoe...@oracle.com> wrote: > > > >> ES6 support is still work in progress, we only support some of it, so > >> making it the default wouldn’t be a good idea. > >> > > > > > > Is there a feature I can help with? If someone points me in the right > > direction, I can submit a patch. I don't see anything in JIRA, really. > > -- Paulo Lopes www.jetdrone.com

Re: Nashorn deprecation

2018-06-15 Thread Paulo Lopes
tinfo/jdk-dev>. > > > > Paulo, your specific experience of already having tried to replace > Nashorn > > with GraalVM.js might be particularly significant. > > > > Best regards, > >   Attila. > > > > > > > On 2018. Jun 11., at 21:35, P

Re: Nashorn deprecation

2018-06-11 Thread Paulo Lopes
Hi, As the "core" developer of JS support for Vert.x this is quite some shocking news as the project really relies on Nashorn for JS support. I've been spending many hours to get GraalVM.js working and to some extent we can run some unmodified application with it, but we're not there yet. For

ES6 after JDK9

2018-02-16 Thread Paulo Lopes
Hi all, I've generated the kangax "compat-tables" for nashorn 1.8 and nashorn 9 (JDK1.8 and JDK9) respectively: https://www.jetdrone.xyz/assets/compat-table/es6/ The current script is waiting a PR review to be merged on the official project: https://github.com/kangax/compat-table/pull/1261

Is there a way to reference the engine from a linker?

2018-03-15 Thread Paulo Lopes
Hi, I'm writing a guarded linker to allow custom casting from JSObject to Vertx custom types. So far so good, the basic tests seem to work but I think I'm writing too much boiler plate code as I need in many times to have an intermediate conversion from JSObject to Map or List. So I know that in

Re: Is there a way to reference the engine from a linker?

2018-04-04 Thread Paulo Lopes
:02, Paulo Lopes <plo...@redhat.com> wrote: > > Hi, > > I'm writing a guarded linker to allow custom casting from JSObject to Vertx > custom types. So far so good, the basic tests seem to work but I think I'm > writing too much boiler plate code as I need in many time

casting typed array to java byte[] is it possible?

2018-10-11 Thread Paulo Lopes
Hi, I'm trying to handle a case where a Uint8Array is being passed to a method, that has the signature: String encode(byte[]); Sadly nashorn fails with: java.lang.ClassCastException: Cannot cast jdk.nashorn.internal.objects.NativeUint8Array to [B And trying to help the cast with:

Re: casting typed array to java byte[] is it possible?

2018-10-12 Thread Paulo Lopes
will introduce a penalty that kind of defeats the whole purpose of using typed arrays to start with. Paulo Lopes Principal Software Engineer   Original Message   From: hannes.wallnoe...@oracle.com Sent: October 12, 2018 10:10 AM To: pmart...@redhat.com Cc: nashorn-dev@openjdk.java.net

Re: casting typed array to java byte[] is it possible?

2018-10-12 Thread Paulo Lopes
of range, byteOffset=0, elementLength=12, bytesPerElement=1 Is this expected? Or can I specify the length somewhere? Also ab.byteLength prints 0 instead of 12... On Fri, 2018-10-12 at 17:34 +0530, Sundararajan Athijegannathan wrote: > Hi Paulo Lopes, > > ArrayBuffer can be created us