anton-vinogradov commented on code in PR #13095:
URL: https://github.com/apache/ignite/pull/13095#discussion_r3559428197


##########
modules/codegen/src/main/java/org/apache/ignite/internal/MarshalledCollection.java:
##########
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/** Marks a {@code Collection} field whose wire form is a companion {@code 
@Order} array field named by {@link #value()}. */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.FIELD)
+public @interface MarshalledCollection {

Review Comment:
   They intentionally encode four different mechanics, not one: `@Marshalled` = 
a single `Marshaller` blob for an arbitrary object; 
`@MarshalledCollection`/`@MarshalledMap` = per-element **Message** 
serialization (no `Marshaller` involved at all; the map flavour needs *two* 
companion fields, `keys()`/`values()`); `@MarshalledObjects` = per-element 
`Marshaller` blobs so each element keeps its own deployment class loader (P2P) 
and query-row keys get finished. Folding them into one annotation would mean a 
union of attributes where half the combinations are invalid (validation moves 
into processor errors), and the field declaration would stop telling the reader 
which of the four mechanics applies.



##########
modules/codegen/src/main/java/org/apache/ignite/internal/MarshalledMap.java:
##########
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/** Marks a {@code Map} field whose wire form is a pair of {@code @Order} 
companion fields: {@link #keys()} and {@link #values()}. */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.FIELD)
+public @interface MarshalledMap {

Review Comment:
   Same as above — plus this one structurally needs two companion fields 
(`keys()`/`values()`), which a shared `value()`-based annotation can't express.



##########
modules/codegen/src/main/java/org/apache/ignite/internal/MarshalledObjects.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Marks a {@code Collection} field of arbitrary (non-{@code Message}) objects 
whose wire form is a companion
+ * {@code @Order Collection<byte[]>} field named by {@link #value()}: each 
element is marshalled to its own
+ * {@code byte[]}, so elements that need different deployment class loaders 
survive. Use {@code @MarshalledCollection}
+ * instead when the elements are {@code Message}s.
+ *
+ * <p>An unmarshalled {@code Map.Entry} element (a query result row) gets its 
{@code KeyCacheObject} key resolved with
+ * the message's cache object context: such a key arrives bytes-only and 
forbids lazy resolution.
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.FIELD)
+public @interface MarshalledObjects {

Review Comment:
   `@Marshalled` already is for non-message fields — but as a *single* blob. 
This one exists for collections needing *per-element* blobs: each element may 
come from a different P2P class loader, and a whole-collection blob would lose 
that (plus the `KeyCacheObject` finish for query rows).



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