manually cherrypicking 2a6f436265dca09edef69b5e20987c9d7d97dcf7 back into groovy-unstable-devel