On 5/14/25 11:55, Jeemol K S via dev wrote:
[...]
In *Groovy 2.x*, it was possible to reference elements directly without specifying the index, such as:


|response.itemResult.itemResultItems.salePrice |

However, in *Groovy 3.x*, the same reference now requires explicit indexing:

|response.itemResult.itemResultItems[0].salePrice |


Let me try to rewrite this with more context


class Result {
  List items
}
class Item {
  def price
}

def item = new Item(price:10)
def result = new Result(items:[item])

println result.items.price

Groovy 2.5, 3.0, 4.0 and 5.0-alpha gives [10]


I am afraid I cannot reproduce the problem. Or is this with static compilation? checking again... needs to be List<Item> but otherwise works with the static type checker as well in all versions I tested

bye Jochen

Reply via email to