Re: RFR 8145630: accidental debug printlns in NativeFunction.java

2015-12-16 Thread Hannes Wallnoefer

+1

Am 2015-12-17 um 06:43 schrieb Sundararajan Athijegannathan:
Please review http://cr.openjdk.java.net/~sundar/8145630/ for 
https://bugs.openjdk.java.net/browse/JDK-8145630


Thanks,
-Sundar




RFR 8145630: accidental debug printlns in NativeFunction.java

2015-12-16 Thread Sundararajan Athijegannathan
Please review http://cr.openjdk.java.net/~sundar/8145630/ for 
https://bugs.openjdk.java.net/browse/JDK-8145630


Thanks,
-Sundar


Re: RFR 8145550: Megamorphic invoke should use CompiledFunction variants without any LinkLogic

2015-12-16 Thread Attila Szegedi
+1

> On Dec 16, 2015, at 2:30 PM, Sundararajan Athijegannathan 
>  wrote:
> 
> Please review http://cr.openjdk.java.net/~sundar/8145550/ for 
> https://bugs.openjdk.java.net/browse/JDK-8145550
> 
> Thanks,
> -Sundar



Re: TypeError: I could use some explanation

2015-12-16 Thread Sundararajan Athijegannathan
Actually, it'd be difficult for us to debug as well. As I said, most 
likely your Java Map passed is being treated as a (JS) script object - 
and it is not. Please note that Nashorn uses wrapperless Java objects 
with scripts - so scripts see the exposed Java objects as plain Java 
objects. So, the solution would be to use an actual script object in 
such cases.


-Sundar

On 12/16/2015 8:52 PM, Kasmeroglu, Daniel wrote:

On Mi, 2015-12-16 at 20:11 +0530, Sundararajan Athijegannathan wrote:

If the script function t4 expects that "t4_context" is a script object
and so calls Object.prototype function or any JS function that expects
"this" to be a script object, you'll get a TypeError (per spec.).  We
need bit more information on the code of "t4" to help further.


The code of 't4' is a problem here as it's generated by Handlebars. It's
ScriptObjectMirror presentation results in:

--8>--
[_setup -> function (setupOptions) {
if (!compiled) {
  compiled = compileInput();
}
return compiled._setup(setupOptions);
  }]
[_child -> function (i, data, blockParams, depths) {
if (!compiled) {
  compiled = compileInput();
}
return compiled._child(i, data, blockParams, depths);
  }]
--<8--

However I don't expect anyone to investigate this code further as I
think this might require quite a bit of work
(https://github.com/wycats/handlebars.js/tree/master). It's essentially
a template which will render it's content with the supplied hash in
question.

Last but not least I figured out a workaround which seem to work fine.
I'm simply adding the entries of the map 't4_context' and I'm generating
the template function call accordingly. F.e.


t4(t4_context)

turns into


t4({'assets': assets, 'def': def})

Nevertheless if someone knows an answer to the problem it would be nice
to know.




-Sundar

On 12/16/2015 7:31 PM, Kasmeroglu, Daniel wrote:

Hi there,

First of all: thanks for the great work with Nashorn.
Unfortunately I'm currently a little bit stuck as I don't get what I'm
doing wrong here.
Here's a simple code snippet that explains what I'm doing:

--<8--
ScriptEngine engine = ...
Map context = ...
engine.put("t4_context", context);
engine.eval("t4(t4_context);");
--8>--

The variable 't4' is a compiled template generated through Handlebars
(so it's a function taking a hash).
Unfortunately I don't get it running as there's the following complain:

--<8--
Caused by: :30 TypeError: {assets=dodo} is not an Object
--8>--

It's clear to me that the issue is caused since the java object
'context' isn't an instance of 'ScriptObject'. However it isn't clear to
me why this happens.

It would be nice to give me a hint of what I'm doing wrong or to point
me to some helpful documentation.

Thanks in advance.






Re: TypeError: I could use some explanation

2015-12-16 Thread Kasmeroglu, Daniel
On Mi, 2015-12-16 at 20:11 +0530, Sundararajan Athijegannathan wrote:
> If the script function t4 expects that "t4_context" is a script object 
> and so calls Object.prototype function or any JS function that expects 
> "this" to be a script object, you'll get a TypeError (per spec.).  We 
> need bit more information on the code of "t4" to help further.
> 
The code of 't4' is a problem here as it's generated by Handlebars. It's
ScriptObjectMirror presentation results in:

--8>--
[_setup -> function (setupOptions) {
if (!compiled) {
  compiled = compileInput();
}
return compiled._setup(setupOptions);
  }]
[_child -> function (i, data, blockParams, depths) {
if (!compiled) {
  compiled = compileInput();
}
return compiled._child(i, data, blockParams, depths);
 }]
--<8--

However I don't expect anyone to investigate this code further as I
think this might require quite a bit of work
(https://github.com/wycats/handlebars.js/tree/master). It's essentially
a template which will render it's content with the supplied hash in
question.

Last but not least I figured out a workaround which seem to work fine.
I'm simply adding the entries of the map 't4_context' and I'm generating
the template function call accordingly. F.e.

> t4(t4_context) 

turns into

> t4({'assets': assets, 'def': def})

Nevertheless if someone knows an answer to the problem it would be nice
to know.



> -Sundar
> 
> On 12/16/2015 7:31 PM, Kasmeroglu, Daniel wrote:
> > Hi there,
> >
> > First of all: thanks for the great work with Nashorn.
> > Unfortunately I'm currently a little bit stuck as I don't get what I'm
> > doing wrong here.
> > Here's a simple code snippet that explains what I'm doing:
> >
> > --<8--
> > ScriptEngine engine = ...
> > Map context = ...
> > engine.put("t4_context", context);
> > engine.eval("t4(t4_context);");
> > --8>--
> >
> > The variable 't4' is a compiled template generated through Handlebars
> > (so it's a function taking a hash).
> > Unfortunately I don't get it running as there's the following complain:
> >
> > --<8--
> > Caused by: :30 TypeError: {assets=dodo} is not an Object
> > --8>--
> >
> > It's clear to me that the issue is caused since the java object
> > 'context' isn't an instance of 'ScriptObject'. However it isn't clear to
> > me why this happens.
> >
> > It would be nice to give me a hint of what I'm doing wrong or to point
> > me to some helpful documentation.
> >
> > Thanks in advance.
> >
> >
> 

-- 
Dipl.-Inform. Daniel Kasmeroglu, Java Developer Advanced

Email daniel.kasmero...@aperto.de
Phone +49 30 283921-381
Fax +49 30 283921-29

Aperto AG - In der Pianofabrik
Chausseestraße 5, D-10115 Berlin-Mitte
http://www.aperto.de
http://www.facebook.com/aperto
https://www.xing.com/companies/apertoag

HRB 77049, AG Berlin Charlottenburg
Vorstand: Dirk Buddensiek (Vorsitzender), Kai Großmann, Stephan Haagen,
Daniel Simon
Aufsichtsrat: Bernd Hardes (Vorsitzender)




Re: TypeError: I could use some explanation

2015-12-16 Thread Sundararajan Athijegannathan
If the script function t4 expects that "t4_context" is a script object 
and so calls Object.prototype function or any JS function that expects 
"this" to be a script object, you'll get a TypeError (per spec.).  We 
need bit more information on the code of "t4" to help further.


-Sundar

On 12/16/2015 7:31 PM, Kasmeroglu, Daniel wrote:

Hi there,

First of all: thanks for the great work with Nashorn.
Unfortunately I'm currently a little bit stuck as I don't get what I'm
doing wrong here.
Here's a simple code snippet that explains what I'm doing:

--<8--
ScriptEngine engine = ...
Map context = ...
engine.put("t4_context", context);
engine.eval("t4(t4_context);");
--8>--

The variable 't4' is a compiled template generated through Handlebars
(so it's a function taking a hash).
Unfortunately I don't get it running as there's the following complain:

--<8--
Caused by: :30 TypeError: {assets=dodo} is not an Object
--8>--

It's clear to me that the issue is caused since the java object
'context' isn't an instance of 'ScriptObject'. However it isn't clear to
me why this happens.

It would be nice to give me a hint of what I'm doing wrong or to point
me to some helpful documentation.

Thanks in advance.






Re: RFR 8145550: Megamorphic invoke should use CompiledFunction variants without any LinkLogic

2015-12-16 Thread Hannes Wallnoefer

Looks good.


Am 2015-12-16 um 14:30 schrieb Sundararajan Athijegannathan:
Please review http://cr.openjdk.java.net/~sundar/8145550/ for 
https://bugs.openjdk.java.net/browse/JDK-8145550


Thanks,
-Sundar




Re: TypeError: I could use some explanation

2015-12-16 Thread Jim Laskey (Oracle)
How is t4_context used in the function? IE., what does line 30 look like?

— Jim


> On Dec 16, 2015, at 10:01 AM, Kasmeroglu, Daniel 
>  wrote:
> 
> Hi there,
> 
> First of all: thanks for the great work with Nashorn.
> Unfortunately I'm currently a little bit stuck as I don't get what I'm
> doing wrong here.
> Here's a simple code snippet that explains what I'm doing:
> 
> --<8--
> ScriptEngine engine = ...
> Map context = ...
> engine.put("t4_context", context);
> engine.eval("t4(t4_context);");
> --8>--
> 
> The variable 't4' is a compiled template generated through Handlebars
> (so it's a function taking a hash).
> Unfortunately I don't get it running as there's the following complain:
> 
> --<8--
> Caused by: :30 TypeError: {assets=dodo} is not an Object
> --8>--
> 
> It's clear to me that the issue is caused since the java object
> 'context' isn't an instance of 'ScriptObject'. However it isn't clear to
> me why this happens. 
> 
> It would be nice to give me a hint of what I'm doing wrong or to point
> me to some helpful documentation.
> 
> Thanks in advance.
> 
> 
> -- 
> Dipl.-Inform. Daniel Kasmeroglu, Java Developer Advanced
> 
> Email daniel.kasmero...@aperto.de
> Phone +49 30 283921-381
> Fax +49 30 283921-29
> 
> Aperto AG - In der Pianofabrik
> Chausseestraße 5, D-10115 Berlin-Mitte
> http://www.aperto.de
> http://www.facebook.com/aperto
> https://www.xing.com/companies/apertoag
> 
> HRB 77049, AG Berlin Charlottenburg
> Vorstand: Dirk Buddensiek (Vorsitzender), Kai Großmann, Stephan Haagen,
> Daniel Simon
> Aufsichtsrat: Bernd Hardes (Vorsitzender)
> 
> 



TypeError: I could use some explanation

2015-12-16 Thread Kasmeroglu, Daniel
Hi there,

First of all: thanks for the great work with Nashorn.
Unfortunately I'm currently a little bit stuck as I don't get what I'm
doing wrong here.
Here's a simple code snippet that explains what I'm doing:

--<8--
ScriptEngine engine = ...
Map context = ...
engine.put("t4_context", context);
engine.eval("t4(t4_context);");
--8>--

The variable 't4' is a compiled template generated through Handlebars
(so it's a function taking a hash).
Unfortunately I don't get it running as there's the following complain:

--<8--
Caused by: :30 TypeError: {assets=dodo} is not an Object
--8>--

It's clear to me that the issue is caused since the java object
'context' isn't an instance of 'ScriptObject'. However it isn't clear to
me why this happens. 

It would be nice to give me a hint of what I'm doing wrong or to point
me to some helpful documentation.

Thanks in advance.


-- 
Dipl.-Inform. Daniel Kasmeroglu, Java Developer Advanced

Email daniel.kasmero...@aperto.de
Phone +49 30 283921-381
Fax +49 30 283921-29

Aperto AG - In der Pianofabrik
Chausseestraße 5, D-10115 Berlin-Mitte
http://www.aperto.de
http://www.facebook.com/aperto
https://www.xing.com/companies/apertoag

HRB 77049, AG Berlin Charlottenburg
Vorstand: Dirk Buddensiek (Vorsitzender), Kai Großmann, Stephan Haagen,
Daniel Simon
Aufsichtsrat: Bernd Hardes (Vorsitzender)




Re: RFR 8145550: Megamorphic invoke should use CompiledFunction variants without any LinkLogic

2015-12-16 Thread Jim Laskey (Oracle)
+1

> On Dec 16, 2015, at 9:30 AM, Sundararajan Athijegannathan 
>  wrote:
> 
> Please review http://cr.openjdk.java.net/~sundar/8145550/ for 
> https://bugs.openjdk.java.net/browse/JDK-8145550
> 
> Thanks,
> -Sundar



RFR 8145550: Megamorphic invoke should use CompiledFunction variants without any LinkLogic

2015-12-16 Thread Sundararajan Athijegannathan
Please review http://cr.openjdk.java.net/~sundar/8145550/ for 
https://bugs.openjdk.java.net/browse/JDK-8145550


Thanks,
-Sundar


Re: RFR 8145486: jjs should support documentation key shortcut in interactive mode

2015-12-16 Thread Hannes Wallnoefer

+1

Am 2015-12-16 um 11:33 schrieb Sundararajan Athijegannathan:

Thanks for the reviews.

Updated webrev: http://cr.openjdk.java.net/~sundar/8145486/webrev.01/

* Fixed documentation for setIndexedPropertiesToExternalArrayData
* Fixed inner/nested class case ($ - > ".")
* Added doc for NativeJavaPackage objects
* Added missing "final" in Console.bind method.

Incremental changes are only in Main.java and Console.java

Please review..

-Sundar

On 12/16/2015 2:48 PM, Hannes Wallnoefer wrote:

Very nice, and works like a charm on Linux.

One nitpick: documentation for 
NativeObject.setIndexedPropertiesToExternalArrayData should start 
with "sets" rather than "set" to be consistent with the rest.


Hannes

Am 2015-12-16 um 05:38 schrieb Sundararajan Athijegannathan:
Please review http://cr.openjdk.java.net/~sundar/8145486/ for 
https://bugs.openjdk.java.net/browse/JDK-8145486


Note that this enhancement only adds jjs changes to show 
documentation when available and infrastructure to attach 
documentation string for JS built-in functions, constructors.
Actual documentation strings are added only for NativeObject. Adding 
documentation string for all other built-in functions, constructors 
will be done in future.


Thanks,
-Sundar








Re: RFR 8145486: jjs should support documentation key shortcut in interactive mode

2015-12-16 Thread Michael Haupt
Hi Sundar,

thumbs are still up!

Best,

Michael

> Am 16.12.2015 um 11:33 schrieb Sundararajan Athijegannathan 
> :
> 
> Thanks for the reviews.
> 
> Updated webrev: http://cr.openjdk.java.net/~sundar/8145486/webrev.01/
> 
> * Fixed documentation for setIndexedPropertiesToExternalArrayData
> * Fixed inner/nested class case ($ - > ".")
> * Added doc for NativeJavaPackage objects
> * Added missing "final" in Console.bind method.
> 
> Incremental changes are only in Main.java and Console.java
> 
> Please review..
> 
> -Sundar
> 
> On 12/16/2015 2:48 PM, Hannes Wallnoefer wrote:
>> Very nice, and works like a charm on Linux.
>> 
>> One nitpick: documentation for 
>> NativeObject.setIndexedPropertiesToExternalArrayData should start with 
>> "sets" rather than "set" to be consistent with the rest.
>> 
>> Hannes
>> 
>> Am 2015-12-16 um 05:38 schrieb Sundararajan Athijegannathan:
>>> Please review http://cr.openjdk.java.net/~sundar/8145486/ for 
>>> https://bugs.openjdk.java.net/browse/JDK-8145486
>>> 
>>> Note that this enhancement only adds jjs changes to show documentation when 
>>> available and infrastructure to attach documentation string for JS built-in 
>>> functions, constructors.
>>> Actual documentation strings are added only for NativeObject. Adding 
>>> documentation string for all other built-in functions, constructors will be 
>>> done in future.
>>> 
>>> Thanks,
>>> -Sundar
>> 
> 

-- 

 
Dr. Michael Haupt | Principal Member of Technical Staff
Phone: +49 331 200 7277 | Fax: +49 331 200 7561
Oracle Java Platform Group | LangTools Team | Nashorn
Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14 | 14467 Potsdam, Germany
  Oracle is committed to developing 
practices and products that help protect the environment



Re: RFR 8145486: jjs should support documentation key shortcut in interactive mode

2015-12-16 Thread Sundararajan Athijegannathan

Thanks for the reviews.

Updated webrev: http://cr.openjdk.java.net/~sundar/8145486/webrev.01/

* Fixed documentation for setIndexedPropertiesToExternalArrayData
* Fixed inner/nested class case ($ - > ".")
* Added doc for NativeJavaPackage objects
* Added missing "final" in Console.bind method.

Incremental changes are only in Main.java and Console.java

Please review..

-Sundar

On 12/16/2015 2:48 PM, Hannes Wallnoefer wrote:

Very nice, and works like a charm on Linux.

One nitpick: documentation for 
NativeObject.setIndexedPropertiesToExternalArrayData should start with 
"sets" rather than "set" to be consistent with the rest.


Hannes

Am 2015-12-16 um 05:38 schrieb Sundararajan Athijegannathan:
Please review http://cr.openjdk.java.net/~sundar/8145486/ for 
https://bugs.openjdk.java.net/browse/JDK-8145486


Note that this enhancement only adds jjs changes to show 
documentation when available and infrastructure to attach 
documentation string for JS built-in functions, constructors.
Actual documentation strings are added only for NativeObject. Adding 
documentation string for all other built-in functions, constructors 
will be done in future.


Thanks,
-Sundar






Re: RFR 8145486: jjs should support documentation key shortcut in interactive mode

2015-12-16 Thread Hannes Wallnoefer

Very nice, and works like a charm on Linux.

One nitpick: documentation for 
NativeObject.setIndexedPropertiesToExternalArrayData should start with 
"sets" rather than "set" to be consistent with the rest.


Hannes

Am 2015-12-16 um 05:38 schrieb Sundararajan Athijegannathan:
Please review http://cr.openjdk.java.net/~sundar/8145486/ for 
https://bugs.openjdk.java.net/browse/JDK-8145486


Note that this enhancement only adds jjs changes to show documentation 
when available and infrastructure to attach documentation string for 
JS built-in functions, constructors.
Actual documentation strings are added only for NativeObject. Adding 
documentation string for all other built-in functions, constructors 
will be done in future.


Thanks,
-Sundar




Re: RFR 8145486: jjs should support documentation key shortcut in interactive mode

2015-12-16 Thread Michael Haupt
Hi Sundar,

very cool. Lower-case thumbs up.

I tested this on the Mac platform, and all the features work, save one little 
thing. Main.openBrowserForJavaDoc does not seem to handle inner classes 
correctly. Entering java.util.HashMap.SimpleEntry in the jjs shell and then 
hitting Shift-Tab will pass the URL 
http://download.java.net/jdk9/docs/api/java/util/AbstractMap$SimpleEntry.html 
to the browser, when 
http://download.java.net/jdk9/docs/api/java/util/AbstractMap.SimpleEntry.html 
is needed. The $->. conversion needs to be added.

Best,

Michael

> Am 16.12.2015 um 05:38 schrieb Sundararajan Athijegannathan 
> :
> 
> Please review http://cr.openjdk.java.net/~sundar/8145486/ for 
> https://bugs.openjdk.java.net/browse/JDK-8145486
> 
> Note that this enhancement only adds jjs changes to show documentation when 
> available and infrastructure to attach documentation string for JS built-in 
> functions, constructors.
> Actual documentation strings are added only for NativeObject. Adding 
> documentation string for all other built-in functions, constructors will be 
> done in future.
> 
> Thanks,
> -Sundar

-- 

 
Dr. Michael Haupt | Principal Member of Technical Staff
Phone: +49 331 200 7277 | Fax: +49 331 200 7561
Oracle Java Platform Group | LangTools Team | Nashorn
Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14 | 14467 Potsdam, Germany
  Oracle is committed to developing 
practices and products that help protect the environment