Test: with({}){ /*force vars into scope*/ function () { /*line 2*/ print("hello from nashorn"); } } print(this["L:2"]) Expected: undefined Observed: function () { /*line 2*/ print("hello from nashorn"); } This bug was reported via nashorn-dev alias ( http://mail.openjdk.java.net/pipermail/nashorn-dev/2015-June/004776.html ) by Andreas Woess