sergey-chugunov-1985 commented on code in PR #12200:
URL: https://github.com/apache/ignite/pull/12200#discussion_r2230925790


##########
modules/codegen2/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java:
##########
@@ -455,6 +467,18 @@ else if (sameType(type, 
"org.apache.ignite.internal.processors.affinity.Affinity
             else if (assignableFrom(type, type(MESSAGE_INTERFACE)))
                 returnFalseIfReadFailed(name, "reader.readMessage");
 
+            else if (assignableFrom(erasedType(type), 
erasedType(Collection.class.getName())) &&
+                !assignableFrom(erasedType(type), 
erasedType(Set.class.getName()))) {
+                List<? extends TypeMirror> typeArgs = 
((DeclaredType)type).getTypeArguments();
+
+                assert typeArgs.size() == 1;
+
+                
imports.add("org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType");

Review Comment:
   We could remove this call as import for `MessageCollectionItemType` has 
already been added when `returnFalseIfWriteFailed` was called.



##########
modules/codegen2/src/main/java/org/apache/ignite/internal/MessageSerializerGenerator.java:
##########
@@ -455,6 +467,18 @@ else if (sameType(type, 
"org.apache.ignite.internal.processors.affinity.Affinity
             else if (assignableFrom(type, type(MESSAGE_INTERFACE)))
                 returnFalseIfReadFailed(name, "reader.readMessage");
 
+            else if (assignableFrom(erasedType(type), 
erasedType(Collection.class.getName())) &&
+                !assignableFrom(erasedType(type), 
erasedType(Set.class.getName()))) {

Review Comment:
   I think we should throw an exception if a Message declares a field of type 
`Set` instead of just ignoring this field and serializing the message anyway.



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

Review Comment:
   How about changing parameter type to Class<?> and calling `getName` on it 
here instead? Right now we have a Class instance in all places where this 
method is called, so no need to use String to pass class name.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/NearCacheUpdates.java:
##########
@@ -17,54 +17,88 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
 
-import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
-import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.Order;
 import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.GridLongList;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.plugin.extensions.communication.Message;
-import 
org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 import org.jetbrains.annotations.Nullable;
 
 /**
  *
  */
 public class NearCacheUpdates implements Message {
     /** Indexes of keys for which values were generated on primary node (used 
if originating node has near cache). */
-    @GridDirectCollection(int.class)
+    @Order(value = 0, method = "nearValuesIndexes")

Review Comment:
   I wonder if we should preserve current serialization order of fields which 
is fixed by writeTo/readFrom methods implementations.
   
   Thus we need to rearrage fields according to e.g. writeTo implementation and 
only after that put `Order` annotations on them.



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