timoninmaxim commented on code in PR #12200:
URL: https://github.com/apache/ignite/pull/12200#discussion_r2245609324


##########
modules/codegen2/src/main/java/org/apache/ignite/internal/Order.java:
##########
@@ -27,9 +27,9 @@
  * <p>
  * The {@code value} indicates the index of the field in the serialization 
order.
  * Fields annotated with {@code @Order} are processed in ascending order of 
their index.
- * <p> By default, it is assumed that getters and setters are named as the 
annotated fields,
- * e.g. field 'val' should have getters and satters with name 'val' (according 
Ignite's to code-style).
- * If you need to override this behavior, you can specify their name in the 
{@link #method} attribute.
+ * <p> By default, it is assumed that getters and setters are named as the 
annotated fields, e.g. field 'val' should

Review Comment:
   Revert changes that are not related to the ticket



##########
modules/codegen2/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java:
##########
@@ -620,6 +658,16 @@ private TypeMirror type(String clazz) {
         return typeElement != null ? typeElement.asType() : null;
     }
 
+    /** */
+    private TypeMirror erasedType(Class<?> cls) {

Review Comment:
   Never used



##########
modules/codegen2/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java:
##########
@@ -620,6 +658,16 @@ private TypeMirror type(String clazz) {
         return typeElement != null ? typeElement.asType() : null;
     }
 
+    /** */
+    private TypeMirror erasedType(Class<?> cls) {

Review Comment:
   Never used



##########
modules/core/src/test/resources/codegen/TestCollectionsMessageSerializer.java:
##########
@@ -0,0 +1,373 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.codegen;
+
+import java.nio.ByteBuffer;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.plugin.extensions.communication.MessageSerializer;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import 
org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.internal.TestCollectionsMessage;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+
+/**
+ * This class is generated automatically.
+ *
+ * @see org.apache.ignite.internal.MessageProcessor
+ */
+public class TestCollectionsMessageSerializer implements MessageSerializer {
+    /** */
+    @Override public boolean writeTo(Message m, ByteBuffer buf, MessageWriter 
writer) {
+        TestCollectionsMessage msg = (TestCollectionsMessage)m;
+
+        writer.setBuffer(buf);
+
+        if (!writer.isHeaderWritten()) {
+            if (!writer.writeHeader(msg.directType()))
+                return false;
+
+            writer.onHeaderWritten();
+        }
+
+        switch (writer.state()) {
+            case 0:
+                if 
(!writer.writeCollection(msg.booleanArrayList(),MessageCollectionItemType.BOOLEAN_ARR))
+                    return false;
+
+                writer.incrementState();
+
+            case 1:
+                if 
(!writer.writeCollection(msg.byteArrayList(),MessageCollectionItemType.BYTE_ARR))

Review Comment:
   add white-space after a comma



##########
modules/codegen2/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java:
##########
@@ -502,6 +522,9 @@ private String messageCollectionItemType(TypeMirror type) 
throws Exception {
 
             if (sameType(type, 
"org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion"))
                 return "AFFINITY_TOPOLOGY_VERSION";
+
+            if (isBoxedType(type))
+                return env.getTypeUtils().unboxedType(type).getKind().name();

Review Comment:
   toString() - similar to primitive types handling



##########
modules/codegen2/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java:
##########
@@ -514,6 +537,21 @@ private String messageCollectionItemType(TypeMirror type) 
throws Exception {
         return "MSG";
     }
 
+    /**
+     * @param type Type.
+     * @return true if the given type is a boxed primitive.
+     */
+    private boolean isBoxedType(TypeMirror type) {

Review Comment:
   `boxedType`



##########
modules/codegen2/README.md:
##########
@@ -11,6 +11,8 @@ The `MessageProcessor` performs the following tasks:
 - **Naming Convention Enforcement**: It verifies that all fields annotated 
with `@Order` have a corresponding pair of accessor methods:
     - A getter named exactly after the field (e.g., `fieldName()`)
     - A setter named after the field, accepting a single argument (e.g., 
`fieldName(Type val)`)
+    - By default, it is assumed that getters and setters are named as the 
annotated fields, e.g. field 'val' should have getters and setters with name 
'val' (according to Ignite's code-style). If you need to override this 
behavior, you can specify their name in the `Order#method` attribute.

Review Comment:
   Please revert changes that are not related to the ticket. Let's create a new 
ticket for fixing docs



##########
modules/core/src/test/resources/codegen/TestMessage.java:
##########
@@ -65,6 +66,12 @@ public class TestMessage implements Message {
     @Order(value = 11, method = "overridenFieldMethod")
     private String field;
 
+    @Order(12)
+    private List<GridCacheVersion> versions;

Review Comment:
   Already test it in TestCollectionsMessage



-- 
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: notifications-unsubscr...@ignite.apache.org

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

Reply via email to