Backport the GRECLIPSE-1519 potential fix

to Groovy 1.8 and 1.7