scriptpad testing

Andreas Rieber rieberandreas at gmail.com
Wed Jan 23 06:05:03 PST 2013


Hi Sundar,

find attached the tgz. You can run it direct with jjs or better with 
jrunscript for the JavaImporter. The exception happens when you select 
samples from the menu. First two entries work, but from 3rd you get the 
exception.

- Andreas

On 23.01.13 14:53, A. Sundararajan wrote:
> HI Andreas,
>
> Sounds good. Please send zip/tar of your modified app
>
> -Sundar
>
> On Wednesday 23 January 2013 07:21 PM, Andreas Rieber wrote:
>> Hi Sundar,
>>
>> it is awt event which ends in a classcastexception. Let me try to 
>> build a smaller sample, or should i send you the scriptpad i have so 
>> you can try?
>>
>> Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: 
>> Cannot cast java.awt.event.ActionEvent to [Ljava.lang.Object;
>>     at 
>> sun.invoke.util.ValueConversions.newClassCastException(ValueConversions.java:461)
>>     at 
>> sun.invoke.util.ValueConversions.castReference(ValueConversions.java:456)
>>     at 
>> jdk.nashorn.internal.javaadapters.java.awt.event.ActionListener.actionPerformed(Unknown 
>> Source)
>>     at 
>> javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
>>     at 
>> javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)
>>
>> - Andreas
>>
>> On 23.01.13 14:36, A. Sundararajan wrote:
>>> Hi Andreas,
>>>
>>> No, I've not fixed anything w.r.t "with" statement. You mentioned 
>>> you had faced complex issues with JSR223 -- I did some fixes in 
>>> nashorn's JSR223 engine implementation.
>>>
>>> For the 'with' issue, Jim has filed a bug
>>>
>>> thanks
>>> -Sundar
>>>
>>> On Wednesday 23 January 2013 07:03 PM, Andreas Rieber wrote:
>>>> Hi Sundar,
>>>>
>>>> i have your last changes, did another update and fresh build 1 
>>>> minute ago:
>>>>
>>>> sh bin/jjs scriptpad.js
>>>> scriptpad.js:7 ReferenceError: "JFrame" is not defined
>>>>
>>>> where the scriptpad.js is:
>>>>
>>>> var guiPkgs = { JFrame: function() { print("created"); } };
>>>>
>>>> with (guiPkgs) {
>>>>     function main() {
>>>>         function createFrame() {
>>>>             var frame = new JFrame();
>>>>         }
>>>>
>>>>         createFrame();
>>>>     }
>>>> }
>>>>
>>>> main();
>>>>
>>>>
>>>> - Andreas
>>>>
>>>>
>>>> On 23.01.13 14:22, A. Sundararajan wrote:
>>>>> Hi,
>>>>>
>>>>> Yes, 'sync' is rhino specific.  'with' statement seems to be a 
>>>>> bug. I'll file a bug.
>>>>>
>>>>> I've recently made some changes to jsr223 interface to nashorn. In 
>>>>> particular global scope handling and multiple globals per engine 
>>>>> etc. have been improved and fixed. Please pull the latest code. 
>>>>> And please send us your test cases showing failure.
>>>>>
>>>>> Thanks,
>>>>> -Sundar
>>>>>
>>>>>
>>>>> On Wednesday 23 January 2013 06:01 PM, Andreas Rieber wrote:
>>>>>> Hi,
>>>>>>
>>>>>> i tried now the scriptpad sample from openjdk with Nashorn and 
>>>>>> have found 2 minor issues.
>>>>>>
>>>>>> The file: 
>>>>>> jdk8/jdk/src/share/sample/scripting/scriptpad/src/resources/conc.js 
>>>>>> relies on a 'sync' function. Looks to be a Rhino only - so a 
>>>>>> migration issue.
>>>>>>
>>>>>> The next one is about scopes in file: 
>>>>>> jdk8/jdk/src/share/sample/scripting/scriptpad/src/resources/scriptpad.js. 
>>>>>> I removed everything unimportant and the following code snippet 
>>>>>> show the problem:
>>>>>>
>>>>>> ------
>>>>>> var guiPkgs = { JFrame: function() { print("created"); } };
>>>>>>
>>>>>> with (guiPkgs) {
>>>>>>     function main() {
>>>>>>         function createFrame() {
>>>>>>             var frame = new JFrame();
>>>>>>         }
>>>>>>
>>>>>>         createFrame();
>>>>>>     }
>>>>>> }
>>>>>>
>>>>>> main();
>>>>>>
>>>>>> ------
>>>>>>
>>>>>> 'created' should come out but JFrame is unknown. I tested this 
>>>>>> with some browsers (Firefox, Safari, Chrome) but only Rhino and 
>>>>>> Firefox can handle that construct.
>>>>>>
>>>>>> I had also some more complex problems related to JSR223 but will 
>>>>>> come back with samples when i can separate them better.
>>>>>>
>>>>>> - Andreas
>>>>>>
>


More information about the nashorn-dev mailing list