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


##########
modules/error-code-annotation-processor/src/main/java/org/apache/ignite/internal/error/code/processor/ErrorCodeGroupProcessor.java:
##########
@@ -140,16 +142,30 @@ 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:
   Also checked on JDK 17, where it produces `@Deprecated`. A public method to 
extract the package was not found. It is present internally in a private field 
of the annotation node, though we cannot access it.



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