Open jrivard opened 4 years ago
I think that an extension for SpotBugs can be appropriate that warns about non tail-recursive method calls. I think it should not perform further investigation whether or not the recursion could be easily improved to be made tail recursive.
How could we determine if an improvement is easy? General code suggestions seem to be of scope for this project.
Thinking about this again, based on what conditions should we report a warning for a recursive method call? We issue a warning if it is non-tail-recursive? That could generate too many warnings for other kinds of recursive functions.
Maybe we should issue a warning, if we encounter a seemingly tail recursive call, and it cannot be optimized due to limitations like virtual functions or others?
This may need more specifics. I'll look into this in the future if I have available time, but can't make a promise.
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/