rpuch commented on code in PR #6299:
URL: https://github.com/apache/ignite-3/pull/6299#discussion_r2225642380


##########
modules/error-code-annotation-processor/src/main/java/org/apache/ignite/internal/error/code/processor/ErrorCodeGroupProcessor.java:
##########
@@ -140,16 +141,29 @@ private Object visitErrorCodeField(VariableTree 
variableTree, Trees trees) {
             var initializer = variableTree.getInitializer();
             var name = variableTree.getName().toString();
             try {
-                // example: args = {"(short) 1"} as List<ExpressionTree>.
-                var args = ((MethodInvocationTree) initializer).getArguments();
-                // example: expr = "(short) 1" as TypeCastTree.
-                var expr = ((TypeCastTree) args.get(0)).getExpression();
-                // example: if expr is "(short) (1)" we should remove 
parentheses
-                if (expr instanceof ParenthesizedTree) {
-                    expr = ((ParenthesizedTree) expr).getExpression();
+                if 
(MethodInvocationTree.class.isAssignableFrom(initializer.getClass())) {
+                    // example: args = {"(short) 1"} as List<ExpressionTree>.
+                    var args = ((MethodInvocationTree) 
initializer).getArguments();
+                    // example: expr = "(short) 1" as TypeCastTree.
+                    var expr = ((TypeCastTree) args.get(0)).getExpression();
+                    // example: if expr is "(short) (1)" we should remove 
parentheses
+                    if (expr instanceof ParenthesizedTree) {
+                        expr = ((ParenthesizedTree) expr).getExpression();
+                    }
+                    // example: extract 1 from "(short) 1" expression.
+                    this.descriptor.errorCodes.add(new ErrorCode((Integer) 
((LiteralTree) expr).getValue(), name));
+                } else if 
(IdentifierTree.class.isAssignableFrom(initializer.getClass())) {
+                    boolean hasDeprecated = 
variableTree.getModifiers().getAnnotations().stream()
+                            .anyMatch(annotation -> 
annotation.toString().contains("Deprecated"));

Review Comment:
   Is there a better way to check whether this is a `@Deprecated` annotation, 
than just look for a substring in the annotation name? Can we compare classes?



##########
modules/platforms/dotnet/Apache.Ignite/ErrorCodes.g.cs:
##########
@@ -450,8 +450,12 @@ public static class Network
             /// <summary> UnresolvableConsistentId error. </summary>
             public const int UnresolvableConsistentId = (GroupCode << 16) | (1 
& 0xFFFF);
 
-            /// <summary> PortInUse error. </summary>
-            public const int PortInUse = (GroupCode << 16) | (2 & 0xFFFF);
+            /// <summary> BindException error. </summary>
+            public const int Bind = (GroupCode << 16) | (2 & 0xFFFF);
+
+            /// <summary> Alias for Bind. This was the old name, now 
deprecated. </summary>
+            [Obsolete]
+            public const int PortInUse = Bind;

Review Comment:
   Was this code generated or written by hand? I don't see where that Obsolete 
is added by a generator, did I just miss this?



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