Copilot commented on code in PR #16276:
URL: https://github.com/apache/grails-core/pull/16276#discussion_r3889807041


##########
grails-core/src/main/groovy/org/grails/compiler/injection/EntityASTTransformation.java:
##########
@@ -47,17 +47,14 @@ public class EntityASTTransformation implements 
ASTTransformation, CompilationUn
 
     public void visit(ASTNode[] astNodes, SourceUnit sourceUnit) {
 
-        if (!(astNodes[0] instanceof AnnotationNode) || !(astNodes[1] 
instanceof AnnotatedNode)) {
+        if (!(astNodes[0] instanceof AnnotationNode node) || !(astNodes[1] 
instanceof AnnotatedNode parent)) {
             throw new RuntimeException("Internal error: wrong types: 
$node.class / $parent.class");

Review Comment:
   This RuntimeException message uses Groovy-style "$node"/$parent 
interpolation inside a Java string literal, so it will always print the literal 
text rather than the actual AST node types. That makes diagnosing internal 
errors much harder.



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