GROOVY-5756: error during class generation: cannot define closures inside methods of an enum instance