You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "nizhikov (via GitHub)" <gi...@apache.org> on 2026/01/30 09:42:38 UTC
[PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
nizhikov opened a new pull request, #12677:
URL: https://github.com/apache/ignite/pull/12677
Thank you for submitting the pull request to the Apache Ignite.
In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:
### The Contribution Checklist
- [ ] There is a single JIRA ticket related to the pull request.
- [ ] The web-link to the pull request is attached to the JIRA ticket.
- [ ] The JIRA ticket has the _Patch Available_ state.
- [ ] The pull request body describes changes that have been made.
The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
- [ ] The pull request title is treated as the final commit message.
The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
- [ ] A reviewer has been mentioned through the JIRA comments
(see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers))
- [ ] The pull request has been checked by the Teamcity Bot and
the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
### Notes
- [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
- [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
- [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
- [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "anton-vinogradov (via GitHub)" <gi...@apache.org>.
anton-vinogradov commented on code in PR #12677:
URL: https://github.com/apache/ignite/pull/12677#discussion_r2755102308
##########
modules/codegen2/src/main/java/org/apache/ignite/internal/idto/IgniteDataTransferObjectProcessor.java:
##########
@@ -107,28 +112,27 @@ private void generateSingle(Element el) {
return;
TypeMirror dtoCls = processingEnv.getElementUtils().getTypeElement(DTO_CLASS).asType();
- TypeMirror argAnnotation = processingEnv.getElementUtils().getTypeElement(ARG_ANNOTATION).asType();
TypeElement clazz = (TypeElement)el;
// Generate code for inner classes.
clazz.getEnclosedElements().forEach(this::generateSingle);
+ if (unsupported.contains(clazz.getQualifiedName().toString()))
Review Comment:
WARN or ERROR required?
##########
modules/codegen2/src/main/java/org/apache/ignite/internal/idto/IDTOSerializerGenerator.java:
##########
@@ -295,21 +320,50 @@ private List<String> fieldsSerdes(
List<VariableElement> flds,
Function<IgniteBiTuple<String, String>, String> lineProvider
) {
+ TypeMirror dtoCls = env.getElementUtils().getTypeElement(DTO_CLASS).asType();
+
List<String> code = new ArrayList<>();
for (VariableElement fld : flds) {
TypeMirror type = fld.asType();
TypeMirror comp = null;
- IgniteBiTuple<String, String> serDes;
+ IgniteBiTuple<String, String> serDes = null;
- if (type.getKind() == TypeKind.ARRAY) {
+ if (env.getTypeUtils().isAssignable(type, dtoCls))
+ serDes = OBJECT_SERDES;
+ else if (type.getKind() == TypeKind.TYPEVAR)
+ serDes = F.t("out.writeObject(obj.${f});", "obj.${f} = in.readObject();");
+ else if (type.getKind() == TypeKind.ARRAY) {
comp = ((ArrayType)type).getComponentType();
- serDes = enumType(env, comp) ? OBJ_ARRAY_SERDES : ARRAY_TYPE_SERDES.get(className(comp));
+ serDes = ARRAY_TYPE_SERDES.get(className(comp));
+
+ if (serDes == null && enumType(env, comp))
+ serDes = OBJ_ARRAY_SERDES;
+ }
+ else {
Review Comment:
lets use elseif instead and check at final else that there is no enexpected type.
##########
modules/codegen2/src/main/java/org/apache/ignite/internal/idto/IgniteDataTransferObjectProcessor.java:
##########
@@ -107,28 +112,27 @@ private void generateSingle(Element el) {
return;
TypeMirror dtoCls = processingEnv.getElementUtils().getTypeElement(DTO_CLASS).asType();
- TypeMirror argAnnotation = processingEnv.getElementUtils().getTypeElement(ARG_ANNOTATION).asType();
TypeElement clazz = (TypeElement)el;
// Generate code for inner classes.
clazz.getEnclosedElements().forEach(this::generateSingle);
+ if (unsupported.contains(clazz.getQualifiedName().toString()))
+ return;
+
if (!processingEnv.getTypeUtils().isAssignable(clazz.asType(), dtoCls))
return;
if (clazz.getModifiers().contains(Modifier.ABSTRACT))
return;
- if (!clazz.getModifiers().contains(Modifier.PUBLIC))
+ if (clazz.getModifiers().contains(Modifier.PRIVATE) && clazz.getModifiers().contains(Modifier.PROTECTED))
Review Comment:
How about to use some annotation instead of "package field" mark?
##########
modules/codegen2/src/main/java/org/apache/ignite/internal/idto/IgniteDataTransferObjectProcessor.java:
##########
@@ -62,23 +62,28 @@ public class IgniteDataTransferObjectProcessor extends AbstractProcessor {
/** Package for serializers. */
private static final String FACTORY_PKG_NAME = "org.apache.ignite.internal.codegen.idto";
- /** Base class that every dto must extend. */
- private static final String DTO_CLASS = "org.apache.ignite.internal.dto.IgniteDataTransferObject";
-
- /**
- * Annotation used in management commands.
- * For now, we restrict set of generated serdes to all management commands argument classes.
- * Because, they strictly follows Ignite codestyle convention.
- * Providing support of all other inheritor of {@code IgniteDataTransferObject} is matter of following improvements.
- */
- private static final String ARG_ANNOTATION = "org.apache.ignite.internal.management.api.Argument";
+ /** Base class that every dto must extends. */
+ static final String DTO_CLASS = "org.apache.ignite.internal.dto.IgniteDataTransferObject";
/** Factory class name. */
public static final String FACTORY_CLASS = "IDTOSerializerFactory";
/** Generated classes. */
private final Map<TypeElement, String> genSerDes = new HashMap<>();
+ /** Currently unsupported classes. */
+ private final Set<String> unsupported = Set.of(
Review Comment:
may be static
##########
modules/codegen2/src/main/java/org/apache/ignite/internal/idto/IDTOSerializerGenerator.java:
##########
@@ -85,22 +98,34 @@ public class IDTOSerializerGenerator {
TYPE_SERDES.put(float.class.getName(), F.t("out.writeFloat(obj.${f});", "obj.${f} = in.readFloat();"));
TYPE_SERDES.put(double.class.getName(), F.t("out.writeDouble(obj.${f});", "obj.${f} = in.readDouble();"));
- IgniteBiTuple<String, String> objSerdes = F.t("out.writeObject(obj.${f});", "obj.${f} = (${c})in.readObject();");
-
- TYPE_SERDES.put(Boolean.class.getName(), objSerdes);
- TYPE_SERDES.put(Byte.class.getName(), objSerdes);
- TYPE_SERDES.put(Short.class.getName(), objSerdes);
- TYPE_SERDES.put(Integer.class.getName(), objSerdes);
- TYPE_SERDES.put(Long.class.getName(), objSerdes);
- TYPE_SERDES.put(Float.class.getName(), objSerdes);
- TYPE_SERDES.put(Double.class.getName(), objSerdes);
+ TYPE_SERDES.put(Boolean.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Byte.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Short.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Integer.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Long.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Float.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Double.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Throwable.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Exception.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Object.class.getName(), OBJECT_SERDES);
TYPE_SERDES.put(String.class.getName(), F.t("U.writeString(out, obj.${f});", "obj.${f} = U.readString(in);"));
TYPE_SERDES.put(UUID.class.getName(), F.t("U.writeUuid(out, obj.${f});", "obj.${f} = U.readUuid(in);"));
TYPE_SERDES.put("org.apache.ignite.lang.IgniteUuid", F.t("U.writeIgniteUuid(out, obj.${f});", "obj.${f} = U.readIgniteUuid(in);"));
- TYPE_SERDES.put("org.apache.ignite.internal.processors.cache.version.GridCacheVersion", objSerdes);
-
+ TYPE_SERDES.put("org.apache.ignite.internal.processors.cache.version.GridCacheVersion", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.lang.IgniteProductVersion", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.internal.binary.BinaryMetadata", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.internal.management.cache.PartitionKey", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.cache.CacheMode",
+ F.t("out.writeByte(CacheMode.toCode(obj.${f}));", "obj.${f} = CacheMode.fromCode(in.readByte());"));
+
+ TYPE_SERDES.put(TreeMap.class.getName(), F.t("U.writeMap(out, obj.${f});", "obj.${f} = U.readTreeMap(in);"));
Review Comment:
How about to write classname or smth similar instead of changing the type of the field to TreeMap?
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #12677:
URL: https://github.com/apache/ignite/pull/12677#issuecomment-3841245236
## [](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) **Quality Gate failed**
Failed conditions
 [97 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) (required ≤ 1)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677)
##
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #12677:
URL: https://github.com/apache/ignite/pull/12677#issuecomment-3839692758
## [](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) **Quality Gate failed**
Failed conditions
 [101 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) (required ≤ 1)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677)
##
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "anton-vinogradov (via GitHub)" <gi...@apache.org>.
anton-vinogradov commented on code in PR #12677:
URL: https://github.com/apache/ignite/pull/12677#discussion_r2755129931
##########
modules/codegen2/src/main/java/org/apache/ignite/internal/idto/IDTOSerializerGenerator.java:
##########
@@ -85,22 +98,34 @@ public class IDTOSerializerGenerator {
TYPE_SERDES.put(float.class.getName(), F.t("out.writeFloat(obj.${f});", "obj.${f} = in.readFloat();"));
TYPE_SERDES.put(double.class.getName(), F.t("out.writeDouble(obj.${f});", "obj.${f} = in.readDouble();"));
- IgniteBiTuple<String, String> objSerdes = F.t("out.writeObject(obj.${f});", "obj.${f} = (${c})in.readObject();");
-
- TYPE_SERDES.put(Boolean.class.getName(), objSerdes);
- TYPE_SERDES.put(Byte.class.getName(), objSerdes);
- TYPE_SERDES.put(Short.class.getName(), objSerdes);
- TYPE_SERDES.put(Integer.class.getName(), objSerdes);
- TYPE_SERDES.put(Long.class.getName(), objSerdes);
- TYPE_SERDES.put(Float.class.getName(), objSerdes);
- TYPE_SERDES.put(Double.class.getName(), objSerdes);
+ TYPE_SERDES.put(Boolean.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Byte.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Short.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Integer.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Long.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Float.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Double.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Throwable.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Exception.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Object.class.getName(), OBJECT_SERDES);
TYPE_SERDES.put(String.class.getName(), F.t("U.writeString(out, obj.${f});", "obj.${f} = U.readString(in);"));
TYPE_SERDES.put(UUID.class.getName(), F.t("U.writeUuid(out, obj.${f});", "obj.${f} = U.readUuid(in);"));
TYPE_SERDES.put("org.apache.ignite.lang.IgniteUuid", F.t("U.writeIgniteUuid(out, obj.${f});", "obj.${f} = U.readIgniteUuid(in);"));
- TYPE_SERDES.put("org.apache.ignite.internal.processors.cache.version.GridCacheVersion", objSerdes);
-
+ TYPE_SERDES.put("org.apache.ignite.internal.processors.cache.version.GridCacheVersion", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.lang.IgniteProductVersion", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.internal.binary.BinaryMetadata", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.internal.management.cache.PartitionKey", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.cache.CacheMode",
+ F.t("out.writeByte(CacheMode.toCode(obj.${f}));", "obj.${f} = CacheMode.fromCode(in.readByte());"));
+
+ TYPE_SERDES.put(TreeMap.class.getName(), F.t("U.writeMap(out, obj.${f});", "obj.${f} = U.readTreeMap(in);"));
Review Comment:
How about to write classname or specify type at annotation or smth similar instead of changing the type of the field to TreeMap?
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #12677:
URL: https://github.com/apache/ignite/pull/12677#issuecomment-3834495254
## [](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) **Quality Gate failed**
Failed conditions
 [104 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) (required ≤ 1)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677)
##
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #12677:
URL: https://github.com/apache/ignite/pull/12677#issuecomment-3834690278
## [](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) **Quality Gate failed**
Failed conditions
 [102 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) (required ≤ 1)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677)
##
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "ac1d0globlya (via GitHub)" <gi...@apache.org>.
ac1d0globlya commented on code in PR #12677:
URL: https://github.com/apache/ignite/pull/12677#discussion_r2755679903
##########
modules/codegen2/src/main/java/org/apache/ignite/internal/idto/IDTOSerializerGenerator.java:
##########
@@ -85,22 +98,34 @@ public class IDTOSerializerGenerator {
TYPE_SERDES.put(float.class.getName(), F.t("out.writeFloat(obj.${f});", "obj.${f} = in.readFloat();"));
TYPE_SERDES.put(double.class.getName(), F.t("out.writeDouble(obj.${f});", "obj.${f} = in.readDouble();"));
- IgniteBiTuple<String, String> objSerdes = F.t("out.writeObject(obj.${f});", "obj.${f} = (${c})in.readObject();");
-
- TYPE_SERDES.put(Boolean.class.getName(), objSerdes);
- TYPE_SERDES.put(Byte.class.getName(), objSerdes);
- TYPE_SERDES.put(Short.class.getName(), objSerdes);
- TYPE_SERDES.put(Integer.class.getName(), objSerdes);
- TYPE_SERDES.put(Long.class.getName(), objSerdes);
- TYPE_SERDES.put(Float.class.getName(), objSerdes);
- TYPE_SERDES.put(Double.class.getName(), objSerdes);
+ TYPE_SERDES.put(Boolean.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Byte.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Short.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Integer.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Long.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Float.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Double.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Throwable.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Exception.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Object.class.getName(), OBJECT_SERDES);
TYPE_SERDES.put(String.class.getName(), F.t("U.writeString(out, obj.${f});", "obj.${f} = U.readString(in);"));
TYPE_SERDES.put(UUID.class.getName(), F.t("U.writeUuid(out, obj.${f});", "obj.${f} = U.readUuid(in);"));
TYPE_SERDES.put("org.apache.ignite.lang.IgniteUuid", F.t("U.writeIgniteUuid(out, obj.${f});", "obj.${f} = U.readIgniteUuid(in);"));
- TYPE_SERDES.put("org.apache.ignite.internal.processors.cache.version.GridCacheVersion", objSerdes);
-
+ TYPE_SERDES.put("org.apache.ignite.internal.processors.cache.version.GridCacheVersion", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.lang.IgniteProductVersion", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.internal.binary.BinaryMetadata", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.internal.management.cache.PartitionKey", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.cache.CacheMode",
+ F.t("out.writeByte(CacheMode.toCode(obj.${f}));", "obj.${f} = CacheMode.fromCode(in.readByte());"));
+
+ TYPE_SERDES.put(TreeMap.class.getName(), F.t("U.writeMap(out, obj.${f});", "obj.${f} = U.readTreeMap(in);"));
Review Comment:
Having field type as TreeMap is enough
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #12677:
URL: https://github.com/apache/ignite/pull/12677#discussion_r2755681833
##########
modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/distribution/CacheDistributionPartition.java:
##########
@@ -32,19 +28,19 @@ public class CacheDistributionPartition extends IgniteDataTransferObject {
private static final long serialVersionUID = 0L;
/** Partition identifier. */
- private int partId;
+ int partId;
/** Flag primary or backup partition. */
- private boolean primary;
+ boolean primary;
Review Comment:
Order support will be added after full migration to code generator
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #12677:
URL: https://github.com/apache/ignite/pull/12677#issuecomment-3822875275
## [](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) **Quality Gate failed**
Failed conditions
 [107 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) (required ≤ 1)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677)
##
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #12677:
URL: https://github.com/apache/ignite/pull/12677#issuecomment-3834801224
## [](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) **Quality Gate failed**
Failed conditions
 [102 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) (required ≤ 1)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677)
##
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "ac1d0globlya (via GitHub)" <gi...@apache.org>.
ac1d0globlya commented on code in PR #12677:
URL: https://github.com/apache/ignite/pull/12677#discussion_r2758675440
##########
modules/codegen2/src/main/java/org/apache/ignite/internal/idto/IgniteDataTransferObjectProcessor.java:
##########
@@ -107,28 +112,27 @@ private void generateSingle(Element el) {
return;
TypeMirror dtoCls = processingEnv.getElementUtils().getTypeElement(DTO_CLASS).asType();
- TypeMirror argAnnotation = processingEnv.getElementUtils().getTypeElement(ARG_ANNOTATION).asType();
TypeElement clazz = (TypeElement)el;
// Generate code for inner classes.
clazz.getEnclosedElements().forEach(this::generateSingle);
+ if (unsupported.contains(clazz.getQualifiedName().toString()))
+ return;
+
if (!processingEnv.getTypeUtils().isAssignable(clazz.asType(), dtoCls))
return;
if (clazz.getModifiers().contains(Modifier.ABSTRACT))
return;
- if (!clazz.getModifiers().contains(Modifier.PUBLIC))
+ if (clazz.getModifiers().contains(Modifier.PRIVATE) && clazz.getModifiers().contains(Modifier.PROTECTED))
Review Comment:
You are commenting code part thats filter out classes, not fields.
Can you, please, clarify the question and proposal.
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #12677:
URL: https://github.com/apache/ignite/pull/12677#issuecomment-3835497378
## [](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) **Quality Gate failed**
Failed conditions
 [101 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) (required ≤ 1)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677)
##
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #12677:
URL: https://github.com/apache/ignite/pull/12677#issuecomment-3839914522
## [](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) **Quality Gate failed**
Failed conditions
 [98 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) (required ≤ 1)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677)
##
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #12677:
URL: https://github.com/apache/ignite/pull/12677#issuecomment-3843018672
## [](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) **Quality Gate failed**
Failed conditions
 [97 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) (required ≤ 1)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677)
##
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #12677:
URL: https://github.com/apache/ignite/pull/12677#issuecomment-3835004117
## [](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) **Quality Gate failed**
Failed conditions
 [101 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677) (required ≤ 1)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=12677)
##
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "anton-vinogradov (via GitHub)" <gi...@apache.org>.
anton-vinogradov commented on code in PR #12677:
URL: https://github.com/apache/ignite/pull/12677#discussion_r2755129931
##########
modules/codegen2/src/main/java/org/apache/ignite/internal/idto/IDTOSerializerGenerator.java:
##########
@@ -85,22 +98,34 @@ public class IDTOSerializerGenerator {
TYPE_SERDES.put(float.class.getName(), F.t("out.writeFloat(obj.${f});", "obj.${f} = in.readFloat();"));
TYPE_SERDES.put(double.class.getName(), F.t("out.writeDouble(obj.${f});", "obj.${f} = in.readDouble();"));
- IgniteBiTuple<String, String> objSerdes = F.t("out.writeObject(obj.${f});", "obj.${f} = (${c})in.readObject();");
-
- TYPE_SERDES.put(Boolean.class.getName(), objSerdes);
- TYPE_SERDES.put(Byte.class.getName(), objSerdes);
- TYPE_SERDES.put(Short.class.getName(), objSerdes);
- TYPE_SERDES.put(Integer.class.getName(), objSerdes);
- TYPE_SERDES.put(Long.class.getName(), objSerdes);
- TYPE_SERDES.put(Float.class.getName(), objSerdes);
- TYPE_SERDES.put(Double.class.getName(), objSerdes);
+ TYPE_SERDES.put(Boolean.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Byte.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Short.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Integer.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Long.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Float.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Double.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Throwable.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Exception.class.getName(), OBJECT_SERDES);
+ TYPE_SERDES.put(Object.class.getName(), OBJECT_SERDES);
TYPE_SERDES.put(String.class.getName(), F.t("U.writeString(out, obj.${f});", "obj.${f} = U.readString(in);"));
TYPE_SERDES.put(UUID.class.getName(), F.t("U.writeUuid(out, obj.${f});", "obj.${f} = U.readUuid(in);"));
TYPE_SERDES.put("org.apache.ignite.lang.IgniteUuid", F.t("U.writeIgniteUuid(out, obj.${f});", "obj.${f} = U.readIgniteUuid(in);"));
- TYPE_SERDES.put("org.apache.ignite.internal.processors.cache.version.GridCacheVersion", objSerdes);
-
+ TYPE_SERDES.put("org.apache.ignite.internal.processors.cache.version.GridCacheVersion", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.lang.IgniteProductVersion", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.internal.binary.BinaryMetadata", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.internal.management.cache.PartitionKey", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion", OBJECT_SERDES);
+ TYPE_SERDES.put("org.apache.ignite.cache.CacheMode",
+ F.t("out.writeByte(CacheMode.toCode(obj.${f}));", "obj.${f} = CacheMode.fromCode(in.readByte());"));
+
+ TYPE_SERDES.put(TreeMap.class.getName(), F.t("U.writeMap(out, obj.${f});", "obj.${f} = U.readTreeMap(in);"));
Review Comment:
How about to write classname or specify type at annotation instead of changing the type of the field to TreeMap?
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on code in PR #12677:
URL: https://github.com/apache/ignite/pull/12677#discussion_r2755682999
##########
modules/codegen2/src/main/java/org/apache/ignite/internal/idto/IgniteDataTransferObjectProcessor.java:
##########
@@ -107,28 +112,27 @@ private void generateSingle(Element el) {
return;
TypeMirror dtoCls = processingEnv.getElementUtils().getTypeElement(DTO_CLASS).asType();
- TypeMirror argAnnotation = processingEnv.getElementUtils().getTypeElement(ARG_ANNOTATION).asType();
TypeElement clazz = (TypeElement)el;
// Generate code for inner classes.
clazz.getEnclosedElements().forEach(this::generateSingle);
+ if (unsupported.contains(clazz.getQualifiedName().toString()))
+ return;
+
if (!processingEnv.getTypeUtils().isAssignable(clazz.asType(), dtoCls))
return;
if (clazz.getModifiers().contains(Modifier.ABSTRACT))
return;
- if (!clazz.getModifiers().contains(Modifier.PUBLIC))
+ if (clazz.getModifiers().contains(Modifier.PRIVATE) && clazz.getModifiers().contains(Modifier.PROTECTED))
Review Comment:
Sorry, I don't understand the question
##########
modules/codegen2/src/main/java/org/apache/ignite/internal/idto/IgniteDataTransferObjectProcessor.java:
##########
@@ -107,28 +112,27 @@ private void generateSingle(Element el) {
return;
TypeMirror dtoCls = processingEnv.getElementUtils().getTypeElement(DTO_CLASS).asType();
- TypeMirror argAnnotation = processingEnv.getElementUtils().getTypeElement(ARG_ANNOTATION).asType();
TypeElement clazz = (TypeElement)el;
// Generate code for inner classes.
clazz.getEnclosedElements().forEach(this::generateSingle);
+ if (unsupported.contains(clazz.getQualifiedName().toString()))
Review Comment:
No
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "anton-vinogradov (via GitHub)" <gi...@apache.org>.
anton-vinogradov commented on code in PR #12677:
URL: https://github.com/apache/ignite/pull/12677#discussion_r2755674634
##########
modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/distribution/CacheDistributionPartition.java:
##########
@@ -32,19 +28,19 @@ public class CacheDistributionPartition extends IgniteDataTransferObject {
private static final long serialVersionUID = 0L;
/** Partition identifier. */
- private int partId;
+ int partId;
/** Flag primary or backup partition. */
- private boolean primary;
+ boolean primary;
Review Comment:
How about order, btw?
Current approach will not allow to change fields
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "anton-vinogradov (via GitHub)" <gi...@apache.org>.
anton-vinogradov commented on code in PR #12677:
URL: https://github.com/apache/ignite/pull/12677#discussion_r2758608351
##########
modules/codegen2/src/main/java/org/apache/ignite/internal/idto/IgniteDataTransferObjectProcessor.java:
##########
@@ -107,28 +112,27 @@ private void generateSingle(Element el) {
return;
TypeMirror dtoCls = processingEnv.getElementUtils().getTypeElement(DTO_CLASS).asType();
- TypeMirror argAnnotation = processingEnv.getElementUtils().getTypeElement(ARG_ANNOTATION).asType();
TypeElement clazz = (TypeElement)el;
// Generate code for inner classes.
clazz.getEnclosedElements().forEach(this::generateSingle);
+ if (unsupported.contains(clazz.getQualifiedName().toString()))
+ return;
+
if (!processingEnv.getTypeUtils().isAssignable(clazz.asType(), dtoCls))
return;
if (clazz.getModifiers().contains(Modifier.ABSTRACT))
return;
- if (!clazz.getModifiers().contains(Modifier.PUBLIC))
+ if (clazz.getModifiers().contains(Modifier.PRIVATE) && clazz.getModifiers().contains(Modifier.PROTECTED))
Review Comment:
Now you're using "package field" mark as a marker that field shoul be serialized. Let's use annotation instead.
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-27709 Generate serdes code for IgniteDataTransferObject [ignite]
Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov merged PR #12677:
URL: https://github.com/apache/ignite/pull/12677
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org