Clarification on `NewMap` and `NewList` in `<actions>` of XML Services

Hi everyone,

I noticed NewMap and NewList types in the <actions> tag for XML services (common-types-3.xsd#L75)

I’m trying to understand their actual use cases. I couldn’t find any implementation that handles them — I checked basicConvert and MClassLoader.commonJavaClassesMap but didn’t find any related logic.

Could someone please shed light on the intended use cases for NewMap and NewList in service actions?

The way I use them is like this:

<set field="map" from="null" type="NewMap"/>
<set field="list" from="null" type="NewList"/>
<set field="map" from="[:]" type="NewMap"/>
<set field="list" from="[]" type="NewList"/>

However, I think that you are right that, in the code, the NewMap and NewList types are not implemented. I assume these types are ignored and the implicit groovy compilation does the type casting as needed.

1 Like

If we’re already using the from attribute to initialize a map or list (e.g., [:] or []), there’s no need to specify the typeattribute explicitly — Groovy handles type inference implicitly.

So yes, we can safely remove type="NewMap" and type="NewList", as there is no defined handling for these types and they are not implemented in the code.

2 Likes