Is delete threaded?

Hannes Wallnoefer hannes.wallnoefer at
Mon Feb 10 00:23:11 PST 2014

Hi Walter,

this is a problem with callsites for global configurable variables not 
being properly guarded. I encountered this problem independently and it 
will be fixed in my next commit, but I created a bug to track it and add 
a test case.


Am 2014-02-09 23:03, schrieb Walter Higgins:
> Hi ,
> Something odd I've noticed in Nashorn (it doesn't happen in JRE 6 or 7)...
> I have some code which sets a global variable for a short period of time
> then deletes the global when it's no longer needed. (my code runs as part
> of an in-game plugin that takes javascript expressions from an in-game
> command prompt)..
> global.self = commandSender;
> try  {
>      var result = scriptingEngine.eval( jsExpression );
>      ...
> } catch (e ) {
> } finally {
>      delete global.self;
> }
> If say jsExpression is ' self ' then the first time round,
> scriptingEngine.eval will return the 'self' object. The 2nd and subsequent
> times this code is executed though, self will be null, which is odd.
> I can work around this by using the new native 'eval()' function but the
> above code worked in JRE 6 and 7. Now it only works once only in JRE8.

More information about the nashorn-dev mailing list