The Daily WTF
Follow
CodeSOD: Recursive Search
Bernard shared a Java method that appears to be unused and never called. The method is a static method on the GroupEntity class called find, which takes a string parameter and returns a GroupEntity object. However, the method simply calls itself recursively with no apparent purpose. This is clearly a mistake, and it's unclear what the original intention was. Perhaps the string was meant to be converted to another type, which would break the recursion. There is an old ticket on the backlog requesting a feature to allow finding groups via a search input, but no one has worked on it yet. The method's recursive calls will likely never finish, making it impossible to implement the feature. The author is being sarcastic about the likelihood of the feature being implemented anytime soon. The method's infinite recursion is a humorous example of poor coding. The article is poking fun at the mistake and the hypothetical scenario where someone tries to use this method.