gnodet commented on code in PR #1195:
URL: https://github.com/apache/maven/pull/1195#discussion_r1251743128
##########
src/mdo/model-v3.vm:
##########
@@ -201,18 +201,27 @@ public class ${class.name}
if (!Objects.equals(map, getDelegate().get${cap}())) {
update(getDelegate().with${cap}(map));
}
- #else
+ #elseif ( $field.to != "String" && $field.type == "java.util.List" &&
$field.multiplicity == "*" )
+ if (${field.name} == null) {
+ ${field.name} = Collections.emptyList();
+ }
if (!Objects.equals(${field.name}, ${pfx}${cap}())) {
- #if ( $field.to != "String" && $field.type == "java.util.List" &&
$field.multiplicity == "*" )
update(getDelegate().with${cap}(
- ${field.name}.stream().map(c ->
c.getDelegate()).collect(Collectors.toList())));
+ ${field.name}.stream().map(c ->
c.getDelegate()).collect(Collectors.toList())));
${field.name}.forEach(e -> e.childrenTracking = this::replace);
- #elseif ( $field.to && $field.to != "String" )
- update(getDelegate().with${cap}(${field.name}.getDelegate()));
- ${field.name}.childrenTracking = this::replace;
- #else
+ }
+ #elseif ( $field.to && $field.to != "String" )
+ if (!Objects.equals(${field.name}, ${pfx}${cap}())){
Review Comment:
The new code looks like:
```
public void setDistributionManagement(DistributionManagement
distributionManagement) {
if (!Objects.equals(distributionManagement,
getDistributionManagement())){
if (distributionManagement != null) {
update(getDelegate().withDistributionManagement(distributionManagement.getDelegate()));
distributionManagement.childrenTracking = this::replace;
} else {
update(getDelegate().withDistributionManagement(null));
}
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]