From what I have read: The reason is because it is not easy to determine which method will actually be called as we have inheritance.
However, why doesn't Java at least have tail-recursion optimization for static methods and enforce proper way to call static methods with the compiler?
Why doesn't Java have any support at all for tail-recursion?
I am not sure if there is any difficulty here at all.
- The other question asks about TCO, this one about TRE. TRE is much simpler than TCO.
- Also, the other question asks about what limitations the JVM imposes on language implementations that wish to compile to the JVM, this question asks about Java, which is the one language that is not restricted by the JVM, since the JVM spec can be changed by the same people who design Java.
- And lastly, there isn't even a restriction in the JVM about TRE, because the JVM does have intra-method GOTO, which is all that's needed for TRE
1Formatting added to call out points made.