kwin commented on code in PR #1660:
URL: https://github.com/apache/maven/pull/1660#discussion_r1720744714


##########
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" )
+    protected ${class.name}(Builder builder${additionalArguments}) {
     #if ( $class.superClass )
         super(
-      #foreach ( $field in $inheritedFields )
-        #set ( $sep = 
"#if(${locationTracking}||$field!=${inheritedFields[${inheritedFields.size()} - 
1]}),#end" )
-            ${field.name}${sep}
-      #end
+        #set ( $sep = "#if(${locationTracking}),#end" )
+            builder${sep}
       #if ( $locationTracking )
             locations
       #end
         );
     #end
     #if ( $class == $root )
-        this.namespaceUri = namespaceUri;
-        this.modelEncoding = modelEncoding;
+        this.namespaceUri = builder.namespaceUri;

Review Comment:
   This requires the base inheritance logic as well



-- 
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: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to