a few minor bugs

Andreas Woess andreas.woess at oracle.com
Tue Jun 16 15:56:42 UTC 2015

Dear Nashorn team,

I'd like to bring a few very minor implementation bugs to your attention 
(proper JS programs are not affected).

> obj."prop"
> obj.'prop'
should be a SyntaxError, but is not in Nashorn. (even with -nse)
> Parser.java:719 #program
>   final Block programBody = new Block(functionToken, functionLine, 
> body.getFlags() | Block.IS_SYNTHETIC, body.getStatements());
> Parser.java:497 #createFunctionNode
>   Token.descPosition(body.getToken()),
Supplied finish parameter to new FunctionNode is 
Token.descPosition(body.getToken()). I'd have expected the finish of the 
body to be passed here.
> ScriptObject.java:402
>   public final boolean isGenericDescriptor() {
>     return isAccessorDescriptor() || isDataDescriptor();
>   }
This method returns the opposite of what the standard describes. 
Actually it's unused.

A follow-up bug on JDK-8056123:
> with({}){ /*force vars into scope*/
>   function () { /*line 2*/
>     print("hello from nashorn");
>   }
> }
> print(this["L:2"]); // print function on line 2
expected: undefined
actual: function ...
I wonder if there's a particular reason for having the assignment (var 
L:2 = function ...) in the AST in the first place.

and finally, BooleanType.java: duplicate license header

Version: some recent jdk9/dev/nashorn revision.

- andreas

More information about the nashorn-dev mailing list