GROOVY-5988: Reference to for-loop parameter leads to type "Object" instead of declared type