some nashorn testing
Andreas Rieber
rieberandreas at gmail.com
Thu Jan 10 05:07:31 PST 2013
Hi Marcus,
i improved the test and found another case (sorry for that ;-)
Whenever you have a fix, i could provide the patch for jrunscript
(workaround working):
./usr/local/src/jdk8/build/linux-i586/j2sdk-image/bin/jrunscript -cp
/usr/local/src/jdk8/nashorn/dist/nashorn.jar:. -l nashorn
nashorn> printf("%03d %2.2f%n",1,2);
001 2.00
nashorn>
- Andreas
On 09.01.13 16:50, Marcus Lagergren wrote:
> My bad. This actually reproduces through the JSR223 bridge. Must be an eval related problem. I am on it!
>
> /M
>
>
> On Jan 9, 2013, at 4:26 PM, Marcus Lagergren <marcus.lagergren at oracle.com> wrote:
>
>> Where did you get/build your nashorn.jar? We'll get proper versioning in there as soon as we've integrated fully with the OpenJDK build system. I still get nothing when I manually build the latest nashorn.jar from the openjdk and run the JS snippet from the command line with java -jar nashorn.jar <program.js> (Haven't gone through the script engine bridge, but as it seems to be a JavaScript problem it should be sufficient to run it as a standalone script). This very much looks like a bug that I fixed before christmas and pushed into the closed repo - I've verified that it made it into the openjdk source.
>> /M
-------------- next part --------------
import javax.script.*;
public class ObjectArray {
public static void objFunc1(Object[] data) {
for (int i = 0; i < data.length; i++) {
System.out.println(i + " " + data[i]);
}
}
public static void objFunc2(Object[][] data) {
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data[i].length; j++) {
System.out.println(i + " " + j + " " + data[i][j]);
}
}
}
public static void main(String args[]) throws Exception {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("nashorn");
engine.eval("Packages.ObjectArray.objFunc1([1,2,3]);");
engine.eval("Packages.ObjectArray.objFunc2([[1,2],[3,4]]);");
}
}
More information about the nashorn-dev
mailing list