Recursion is a technique to solve a computational problem by splitting it into smaller problems. A method is recursive, if it splits its input into
smaller instances and calls itself on these instances. This continues until a smallest input, a base case, is reached that can not be split
further. Similarly, recursion can also occur when multiple methods invoke each other.
Recursion is a useful tool, but it must be used carefully. Recursive methods need to detect base cases and end recursion with a return
statement. When this is not the case, recursion will continue until the stack overflows and the program crashes due to a
StackOverflowError
.
What is the potential impact?
Issues of this type interrupt the normal execution of a program, causing it to crash or putting it into an inconsistent state. Therefore, this
issue might impact the availability and reliability of your application, or even result in data loss.