GROOVY-5906: Fixed a stack overflow