Tail Call Optimisation in Java
问题 As of Java 8 , Java does not provide Tail-Call Optimization (TCO). On researching about it, I came to know the reason which is: in jdk classes [...] there are a number of security sensitive methods that rely on counting stack frames between jdk library code and calling code to figure out who's calling them. However Scala , which is based on JVM has support for Tail-Call Optimisation. Scala does tail recursion optimisation at compile-time . Why can't Java use the same approach ? PS: Not sure