Serious bug: "finally" block is run whenever "continue" is reached

Tal Liron tal.liron at
Mon Mar 9 13:22:16 UTC 2015

Could you possibly articulate 1) *exactly* what the issue is, 2) how to 
search for potential issues in my vast amount of JavaScript code, 3) and 
how to work around it?

The problem is that I'm not self-deploying: I am building products that 
run on top of the JVM with JavaScript, and yet I cannot recommend 
Nashorn to anyone in its current state. At the very least, I can make 
sure that my own JavaScript code works with 8u40.

Actually, the "meta" bug here is that Nashorn's release system is 
broken: these kinds of breaking bugs need an immediate notice and a fix 
released to the public. And yet Nashorn is tied to JDK releases, which 
are once every six months. Something is very wrong about this system, 
and I'm sure it must be frustrating to the Nashorn team, too.

Barring the possibility of a bugfix release, there *must* to be a "known 
issues" right there on the JDK download page. You simply cannot release 
a JavaScript engine to the public that does not honor try/finally.

On 03/09/2015 02:48 AM, Attila Szegedi wrote:
> This isn't new to 8u40; I just tested, and it's broken in 8u31 and 
> 8u25 too. If I had to guess, it has been like this since the initial 
> release. I base my guess on the fact that the way Nashorn compiled 
> finally blocks in presence of control flow transfers 
> (break/continue/return) was unfortunately broken, I myself discovered 
> this last December and fixed it early February – that's indeed the 
> JIRA issue that Anthony pointed out. Unfortunately, it didn't make it 
> in time for 8u40 :-(

More information about the nashorn-dev mailing list