scriptpad close to finish

Andreas Rieber rieberandreas at gmail.com
Thu Feb 28 08:03:09 PST 2013


Hi,

i finished the nashorn-scriptpad patch and tested also all 
jdk/src/share/sample/scripting.... Found only two more minor issues.

-- CASE 1 --
var charsLeft = 100;
charsLeft -= 58;

var min = java.lang.Math.min(4096, charsLeft);

print(min);
--

the result should be 42, what else ;-) To get scriptpad working i 
changed it to Math.min(). It fails with:

java.lang.RuntimeException: java.lang.NoSuchMethodException: Can't 
unambiguously select between fixed arity signatures [(double, double), 
(int, int)] of the method java.lang.Math.min for argument types 
[java.lang.Integer, java.lang.Double]
     at 
jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:349)
     at 
jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:405)
     at 
jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:379)
     at 
jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:126)
     at 
javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
     at com.sun.tools.script.shell.Main.evaluateReader(Main.java:332)
     at com.sun.tools.script.shell.Main.evaluateStream(Main.java:368)
...


-- CASE 2 --
var chooser = new javax.swing.JColorChooser();
var res = chooser.showDialog(null, "Choose Color", java.awt.Color.BLACK);

print(res);
--

should open the color dialog, but fails with:

script error in file colorChooser.js : TypeError: 
javax.swing.JColorChooser[,0,0,0x0,invalid,layout=java.awt.BorderLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=8,maximumSize=,minimumSize=,preferredSize=,chooserPanels=[javax.swing.colorchooser.DefaultSwatchChooserPanel[,0,0,0x0,invalid,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=8388617,maximumSize=,minimumSize=,preferredSize=]][javax.swing.colorchooser.ColorChooserPanel[,0,0,0x0,invalid,layout=java.awt.GridBagLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=8388617,maximumSize=,minimumSize=,preferredSize=]][javax.swing.colorchooser.ColorChooserPanel[,0,0,0x0,invalid,layout=java.awt.GridBagLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=8388617,maximumSize=,minimumSize=,preferredSize=]][javax.swing.colorchooser.ColorChooserPanel[,0,0,0x0,invalid,layout=java.awt.GridBagLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=8388617,maximumSize=,minimumSize=,preferredSize=]][javax.swing.colorchooser.ColorChooserPanel[,0,0,0x0,invalid,layout=java.awt.GridBagLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=8388617,maximumSize=,minimumSize=,preferredSize=]],previewPanel=javax.swing.colorchooser.DefaultPreviewPanel[,0,0,0x0,invalid,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=8388617,maximumSize=,minimumSize=,preferredSize=]] 
has no such function "showDialog" in colorChooser.js at line number 3


I guess Sundar is the one for the scriptpad patch? Will send separate 
mail...

Andreas




More information about the nashorn-dev mailing list