shishkovilja commented on code in PR #13220:
URL: https://github.com/apache/ignite/pull/13220#discussion_r3381907106


##########
modules/codegen/src/main/java/org/apache/ignite/internal/MessageProcessor.java:
##########
@@ -146,6 +151,34 @@ public class MessageProcessor extends AbstractProcessor {
         return true;
     }
 
+    /** */
+    private boolean checkConstructors(TypeElement clazz) {
+        boolean isMarshallableMsg = isAssignable(
+            clazz.asType(),
+            
processingEnv.getElementUtils().getTypeElement("org.apache.ignite.internal.MarshallableMessage")
+        );
+
+        for (Element el : clazz.getEnclosedElements()) {
+            if (el.getKind() != ElementKind.CONSTRUCTOR)
+                continue;
+
+            ExecutableElement c = (ExecutableElement)el;
+
+            boolean isDfltConstructor = F.isEmpty(c.getParameters());
+
+            if (isDfltConstructor && !isMarshallableMsg)
+                return true;
+        }
+
+        processingEnv.getMessager().printMessage(
+            Diagnostic.Kind.ERROR,
+            "A class must have a default constructor: " + 
clazz.getQualifiedName(),

Review Comment:
   ```suggestion
               "A class must have a public default constructor: " + 
clazz.getQualifiedName(),
   ```



##########
modules/codegen/src/main/java/org/apache/ignite/internal/MessageProcessor.java:
##########
@@ -146,6 +151,34 @@ public class MessageProcessor extends AbstractProcessor {
         return true;
     }
 
+    /** */
+    private boolean checkConstructors(TypeElement clazz) {
+        boolean isMarshallableMsg = isAssignable(
+            clazz.asType(),
+            
processingEnv.getElementUtils().getTypeElement("org.apache.ignite.internal.MarshallableMessage")
+        );
+
+        for (Element el : clazz.getEnclosedElements()) {
+            if (el.getKind() != ElementKind.CONSTRUCTOR)
+                continue;
+
+            ExecutableElement c = (ExecutableElement)el;
+
+            boolean isDfltConstructor = F.isEmpty(c.getParameters());
+
+            if (isDfltConstructor && !isMarshallableMsg)

Review Comment:
   We don't need this check, because `MarshallableMessage` iheritors should 
have default constructor too: 
https://github.com/apache/ignite/blob/938452eb63a7646c9029a16c3e6a52aec2d51012/modules/core/src/main/java/org/apache/ignite/internal/plugin/AbstractMarshallableMessageFactoryProvider.java#L68
   
   Also we need to check that constructor is pulbic, eg.:
   ```
   c.getModifiers().contains(Modifier.PUBLIC);
   ```
   



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