Re: Nashorn StackOverflowError

2018-05-30 Thread Attila Szegedi
This is because the parser is recursively processing the if-else branches. This is one huge if statement. It's basically equivalent to if (true) { print(x); } else { if (true) { print(x); } else { if (true) { print(x); } else { … } } so the parser code even

Nashorn StackOverflowError

2018-05-30 Thread Richard Tolbert
Nashorn throws a StackOverflowError if there are a few hundred if else statements in a function. function whyDoesThisThrowStackOverflowError(x) { if (true) { print(x); } else if (true) { print(x); } else if (true) { print(x); } else if (true) { print(x); } else if (true) { print(x); }