Is delete threaded?
Walter Higgins
walter.higgins at gmail.com
Sun Feb 9 14:03:36 PST 2014
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.
--
Walter Higgins
Mobile: (+353) 086 8511600
Website: http://walterhiggins.net/
More information about the nashorn-dev
mailing list