gnodet commented on code in PR #1660:
URL: https://github.com/apache/maven/pull/1660#discussion_r1720833527
##########
src/mdo/model.vm:
##########
@@ -142,46 +142,33 @@ public class ${class.name}
#end
/**
- * Constructor for this class, package protected.
+ * Constructor for this class, to be called from {@link Builder} and its
subclasses.
* @see Builder#build()
*/
- ${class.name}(
- #if ( $class == $root )
- String namespaceUri,
- String modelEncoding,
- #end
- #foreach ( $field in $allFields )
- #set ( $sep =
"#if(${locationTracking}||$field!=${allFields[${allFields.size()} - 1]}),#end" )
- #set ( $type =
${types.getOrDefault($field,${types.getOrDefault($field.type,$field.type)})} )
- #if ( $type.startsWith("List<") )
- #set ( $type = ${type.replace('List<','Collection<')} )
- #end
- $type $field.name${sep}
- #end
- #if ( $locationTracking )
- Map<Object, InputLocation> locations
- #end
- ) {
+ #set ( $additionalArguments = "#if(${locationTracking}), Map<Object,
InputLocation> locations#end" )
Review Comment:
The `$additionalArguments` need to be removed, they are also fields on the
`builder` argument.
##########
src/mdo/model.vm:
##########
@@ -480,23 +467,8 @@ public class ${class.name}
locations.put("${field.name}",
newlocs.containsKey("${field.name}") ? newlocs.get("${field.name}") :
oldlocs.get("${field.name}"));
#end
#end
- return new ${class.name}(
- #if ( $class == $root )
- namespaceUri != null ? namespaceUri : (base != null ?
base.namespaceUri : ""),
- modelEncoding != null ? modelEncoding : (base != null ?
base.modelEncoding : "UTF-8"),
- #end
- #foreach ( $field in $allFields )
- #set ( $sep =
"#if(${locationTracking}||$field!=${allFields[${allFields.size()} - 1]}),#end" )
- #if ( $field.type == "boolean" || $field.type == "int" )
- ${field.name} != null ? ${field.name} : (base != null ?
base.${field.name} : ${field.defaultValue})${sep}
- #else
- ${field.name} != null ? ${field.name} : (base != null ?
base.${field.name} : null)${sep}
- #end
- #end
- #if ( $locationTracking )
- locations
- #end
- );
+ #set ( $additionalArguments = "#if(${locationTracking}), locations#end" )
Review Comment:
Same here
--
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]