Tag Archives: Infinite loops

Testing (in)finite loops with Java 8 enabled unit tests

java8This post is an extension to the Infinite loops, halting problem and FindBugs containing slightly refactored core code and prepared unit tests using Java SE 8 capabilities. The main extension point is the class LoopUtils which provides methods allowing to verify loops finiteness. Thanks to these methods it is possible to classify methods to finite and infinite. Finiteness is determined by a flexible defined timeout. When a single method’s execution time reaches value of timeout then an execution is classified as infinite. The new code takes advantages on few Java SE 8 new possibilities. The source code is in the same repository but in a dedicated java8enabled branch [1].

Continue reading

Infinite loops, halting problem and FindBugs

infiniteThis post is about halting problem, infinite loops and their detection in FindBugsTM. The initial inspiration to write it was Tom Stuart’s presentation “Impossible Programs” from QCon London 2014 Conference and further investigation of the mentioned issues. In the beginning there are introduced basic terms and then is the practical part with Java code snippets with the FindBugs analysis outcome.

Continue reading