SammyVimes commented on code in PR #2040:
URL: https://github.com/apache/ignite-3/pull/2040#discussion_r1191057396


##########
modules/network-annotation-processor/src/main/java/org/apache/ignite/internal/network/processor/messages/MessageImplGenerator.java:
##########
@@ -688,26 +721,52 @@ private static TypeSpec generateBuilderImpl(
                 .addFields(fields)
                 .addMethods(setters)
                 .addMethods(getters)
-                .addMethod(buildMethod(message, messageImplClass, fields))
+                .addMethod(buildMethod(message, messageImplClass, fields, 
notNullFieldNames, marshallableFieldNames))
                 .build();
     }
 
     /**
      * Generates the {@code build()} method for the Builder interface 
implementation.
      */
-    private static MethodSpec buildMethod(MessageClass message, ClassName 
messageImplClass, List<FieldSpec> fields) {
-        String constructorParameters = fields.stream()
-                .map(field -> field.name)
-                .collect(Collectors.joining(", ", "(", ")"));
+    private static MethodSpec buildMethod(MessageClass message, ClassName 
messageImplClass, List<FieldSpec> fields,
+            Set<String> notNullFieldNames, Set<String> marshallableFieldNames) 
{
+
+        CodeBlock.Builder methodBodyBuilder = CodeBlock.builder();
+
+        methodBodyBuilder.add("return new $T", messageImplClass);
+
+        CodeBlock constructorArgs = fields.stream()
+                .map(field -> {
+                    String fieldName = field.name;
+
+                    if (notNullFieldNames.contains(fieldName) && 
!marshallableFieldNames.contains(fieldName)) {

Review Comment:
   Everything but marshallable can be checked in the builder



-- 
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]

Reply via email to