Seems like this would be a good spotbugs check to identify recursion that could easily be improved by the programmer. Spotbugs doesn't modify the output but can produce a warning when such a condition exists which would be helpful.
https://spotbugs.github.io/