The avatar.js test test-repl.js throws this exception with 8u40 - "java.lang.ClassCastException: jdk.nashorn.internal.scripts.JO4 cannot be cast to jdk.nashorn.internal.runtime.UserAccessorProperty$Accessors".
This error does not occur with 8u20. It also occurs with 8u40 with optimistic types turned off.
The error happens here -
sending "url.format(\"http://google.com\")"
Unix data: "java.lang.ClassCastException: jdk.nashorn.internal.scripts.JO4 cannot be cast to jdk.nashorn.internal.runtime.UserAccessorProperty$Accessors\nnode via Unix socket> ", expecting "http://google.com/"
This error can also be reproduced running the REPL manually -
java -Dnashorn.args='--optimistic-types=false' -jar dist/avatar-js.jar
> url.format("http://google.com")
java.lang.ClassCastException: jdk.nashorn.internal.scripts.JO4 cannot be cast to jdk.nashorn.internal.runtime.UserAccessorProperty$Accessors
But a simple test case works fine -
cat format.js
print(require('url').format("http://google.com"));
java -Dnashorn.args='--optimistic-types=false' -jar dist/avatar-js.jar format.js
http://google.com/
Something in url.format does not work with 8u40 when called by a REPL.