Re: Bug report: can't call static methods on a Java class instance

2019-10-30 Thread Matt Zand
Hey guys, How I can un-subscribe from this mailing list Thx, On Wed, Oct 30, 2019 at 9:33 AM tibetty wrote: > t works and many thanks for your timely response, Joao! However, > personally > I think it's problematic for Nashorn not to support the static method > invocation from an extended cl

Re: Bug report: can't call static methods on a Java class instance

2019-10-30 Thread tibetty
t works and many thanks for your timely response, Joao! However, personally I think it's problematic for Nashorn not to support the static method invocation from an extended class. Any design consideration under the hood? -- Sent from: http://nashorn.36665.n7.nabble.com/

Re: Bug report: can't call static methods on a Java class instance

2019-10-30 Thread tibetty
It works and many thanks for your timely response, Joao! However, personally I think it's problematic for Nashorn not to support the static method invocation from an extended class. Any design consideration under the hood? On Wed, Oct 30, 2019 at 8:27 PM João Paulo Varandas wrote: > Call parse

Re: Bug report: can't call static methods on a Java class instance

2019-10-30 Thread João Paulo Varandas
Call parseObject directly from the class that contains the static method, not from the extended one. var jso = Java.type('com.alibaba.fastjson.JSON').parseObject(json); https://github.com/alibaba/fastjson/blob/master/src/main/java/com/alibaba/fastjson/JSON.java On Wed, Oct 30, 2019 at 9:22

Re: Bug report: can't call static methods on a Java class instance

2019-10-30 Thread tibetty
I used your method, but it stills failed calling a static method of a 3rd party class (com.alibaba.fastjson.JSONObject): Nashorn (JS) code: var jso = Java.type('com.alibaba.fastjson.JSONObject').parseObject(json); Error Message: Exception in thread "main" javax.script.ScriptException: TypeError: J

Re: Bug report: can't call static methods on a Java class instance

2013-10-09 Thread Tal Liron
Again, I do understand your conviction, but "sloppy" (or "simple"?) is exactly what most dynamic languages are all about. If a programmer wanted to use Java, they would. But when working in JavaScript, expectations are quite different. Unfortunately, in my opinion, Nashorn right now requires Ja

Re: Bug report: can't call static methods on a Java class instance

2013-10-09 Thread Attila Szegedi
On Oct 9, 2013, at 4:58 PM, Tal Liron wrote: > I understand the workaround, but again I fail to see the rationale behind > Nashorn's overly-strict interface to Java. What's wrong with supporting the > shorthand in Nashorn, especially when Rhino behaves as JavaScript programmers > would expec

Re: Bug report: can't call static methods on a Java class instance

2013-10-09 Thread Tal Liron
I understand the workaround, but again I fail to see the rationale behind Nashorn's overly-strict interface to Java. What's wrong with supporting the shorthand in Nashorn, especially when Rhino behaves as JavaScript programmers would expect? On 10/09/2013 10:55 PM, Attila Szegedi wrote: Yup.

Re: Bug report: can't call static methods on a Java class instance

2013-10-09 Thread Attila Szegedi
Yup. Static methods can't be invoked on instances. This is by design. The following will work: Java.type("MyClass").myMethod() of course, you can reuse it as: var MyClass = Java.type("MyClass") ... MyClass.myMethod() As a matter of fact, you can even get the met