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


##########
modules/codegen/src/main/java/org/apache/ignite/internal/MessageDeploymentGenerator.java:
##########
@@ -0,0 +1,248 @@
+/*
+ * 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.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.type.WildcardType;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Generates a {@code *Deployer} class for messages whose {@code @Order} 
fields have a type that indicates deployment
+ * need: {@code CacheObject} subtypes, {@code Collection<? extends 
CacheObject>}, {@code Iterable<IgniteTxEntry>}, or a
+ * nested {@code GridCacheMessage} (whose deployment is delegated). The 
strategy is inferred entirely from the field type.
+ *
+ * <p>A message with deployment logic that cannot be inferred from field types 
implements {@code DeployableMessage};
+ * the generated deployer then also delegates to its {@code deploy}, mirroring 
{@code marshal}.
+ */
+public class MessageDeploymentGenerator extends MessageGenerator {
+    /** FQN of GridCacheMessage; hierarchy scan stops here (exclusive). */
+    private static final String GRID_CACHE_MESSAGE = 
"org.apache.ignite.internal.processors.cache.GridCacheMessage";
+
+    /** */
+    private final TypeMirror gridCacheMessageMirror;

Review Comment:
   Fixed — renamed per the abbreviation convention (`Msg`/`Obj`), matching 
`marshallableMsgType` in the sibling generator.



##########
modules/codegen/src/main/java/org/apache/ignite/internal/MessageDeploymentGenerator.java:
##########
@@ -0,0 +1,248 @@
+/*
+ * 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.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.type.WildcardType;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Generates a {@code *Deployer} class for messages whose {@code @Order} 
fields have a type that indicates deployment
+ * need: {@code CacheObject} subtypes, {@code Collection<? extends 
CacheObject>}, {@code Iterable<IgniteTxEntry>}, or a
+ * nested {@code GridCacheMessage} (whose deployment is delegated). The 
strategy is inferred entirely from the field type.
+ *
+ * <p>A message with deployment logic that cannot be inferred from field types 
implements {@code DeployableMessage};
+ * the generated deployer then also delegates to its {@code deploy}, mirroring 
{@code marshal}.
+ */
+public class MessageDeploymentGenerator extends MessageGenerator {
+    /** FQN of GridCacheMessage; hierarchy scan stops here (exclusive). */
+    private static final String GRID_CACHE_MESSAGE = 
"org.apache.ignite.internal.processors.cache.GridCacheMessage";
+
+    /** */
+    private final TypeMirror gridCacheMessageMirror;
+
+    /** */
+    private final TypeMirror deployableMessageMirror;

Review Comment:
   Fixed — renamed per the abbreviation convention (`Msg`/`Obj`), matching 
`marshallableMsgType` in the sibling generator.



##########
modules/codegen/src/main/java/org/apache/ignite/internal/MessageDeploymentGenerator.java:
##########
@@ -0,0 +1,248 @@
+/*
+ * 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.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.type.WildcardType;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Generates a {@code *Deployer} class for messages whose {@code @Order} 
fields have a type that indicates deployment
+ * need: {@code CacheObject} subtypes, {@code Collection<? extends 
CacheObject>}, {@code Iterable<IgniteTxEntry>}, or a
+ * nested {@code GridCacheMessage} (whose deployment is delegated). The 
strategy is inferred entirely from the field type.
+ *
+ * <p>A message with deployment logic that cannot be inferred from field types 
implements {@code DeployableMessage};
+ * the generated deployer then also delegates to its {@code deploy}, mirroring 
{@code marshal}.
+ */
+public class MessageDeploymentGenerator extends MessageGenerator {
+    /** FQN of GridCacheMessage; hierarchy scan stops here (exclusive). */
+    private static final String GRID_CACHE_MESSAGE = 
"org.apache.ignite.internal.processors.cache.GridCacheMessage";
+
+    /** */
+    private final TypeMirror gridCacheMessageMirror;
+
+    /** */
+    private final TypeMirror deployableMessageMirror;
+
+    /** */
+    private final TypeMirror cacheObjectMirror;

Review Comment:
   Fixed — renamed per the abbreviation convention (`Msg`/`Obj`), matching 
`marshallableMsgType` in the sibling generator.



##########
modules/codegen/src/main/java/org/apache/ignite/internal/MessageDeploymentGenerator.java:
##########
@@ -0,0 +1,248 @@
+/*
+ * 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.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.type.WildcardType;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Generates a {@code *Deployer} class for messages whose {@code @Order} 
fields have a type that indicates deployment
+ * need: {@code CacheObject} subtypes, {@code Collection<? extends 
CacheObject>}, {@code Iterable<IgniteTxEntry>}, or a
+ * nested {@code GridCacheMessage} (whose deployment is delegated). The 
strategy is inferred entirely from the field type.
+ *
+ * <p>A message with deployment logic that cannot be inferred from field types 
implements {@code DeployableMessage};
+ * the generated deployer then also delegates to its {@code deploy}, mirroring 
{@code marshal}.
+ */
+public class MessageDeploymentGenerator extends MessageGenerator {
+    /** FQN of GridCacheMessage; hierarchy scan stops here (exclusive). */
+    private static final String GRID_CACHE_MESSAGE = 
"org.apache.ignite.internal.processors.cache.GridCacheMessage";
+
+    /** */
+    private final TypeMirror gridCacheMessageMirror;
+
+    /** */
+    private final TypeMirror deployableMessageMirror;
+
+    /** */
+    private final TypeMirror cacheObjectMirror;
+
+    /** */
+    private final TypeMirror txEntryMirror;
+
+    /** */
+    private final TypeMirror collectionMirror;
+
+    /** */
+    private final TypeMirror iterableMirror;
+
+    /** Accumulated source lines for the generated {@code deploy} method. */

Review Comment:
   Clarified — it's the generated `GridCacheMessageDeployer#deploy` 
implementation (that's the interface generated deployers implement; 
`DeployableMessage#deploy` is the hand-written hook the generated code only 
delegates to).



##########
modules/codegen/src/main/java/org/apache/ignite/internal/MessageDeploymentGenerator.java:
##########
@@ -0,0 +1,248 @@
+/*
+ * 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.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.type.WildcardType;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Generates a {@code *Deployer} class for messages whose {@code @Order} 
fields have a type that indicates deployment
+ * need: {@code CacheObject} subtypes, {@code Collection<? extends 
CacheObject>}, {@code Iterable<IgniteTxEntry>}, or a
+ * nested {@code GridCacheMessage} (whose deployment is delegated). The 
strategy is inferred entirely from the field type.
+ *
+ * <p>A message with deployment logic that cannot be inferred from field types 
implements {@code DeployableMessage};
+ * the generated deployer then also delegates to its {@code deploy}, mirroring 
{@code marshal}.
+ */
+public class MessageDeploymentGenerator extends MessageGenerator {
+    /** FQN of GridCacheMessage; hierarchy scan stops here (exclusive). */
+    private static final String GRID_CACHE_MESSAGE = 
"org.apache.ignite.internal.processors.cache.GridCacheMessage";
+
+    /** */
+    private final TypeMirror gridCacheMessageMirror;
+
+    /** */
+    private final TypeMirror deployableMessageMirror;
+
+    /** */
+    private final TypeMirror cacheObjectMirror;
+
+    /** */
+    private final TypeMirror txEntryMirror;
+
+    /** */
+    private final TypeMirror collectionMirror;
+
+    /** */
+    private final TypeMirror iterableMirror;
+
+    /** Accumulated source lines for the generated {@code deploy} method. */
+    private final List<String> deploy = new ArrayList<>();
+
+    /** */
+    private boolean needsCctx;
+
+    /** */
+    MessageDeploymentGenerator(ProcessingEnvironment env) {
+        super(env);
+
+        gridCacheMessageMirror = type(GRID_CACHE_MESSAGE);

Review Comment:
   Fixed — the constant had a single use, inlined it; all types are plain 
strings now.



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