jdaugherty commented on code in PR #15557:
URL: https://github.com/apache/grails-core/pull/15557#discussion_r3389365702
##########
grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/reflect/AstUtils.groovy:
##########
@@ -248,8 +248,20 @@ class AstUtils {
VariableScopeVisitor scopeVisitor = new VariableScopeVisitor(source)
if (methodNode == null) {
scopeVisitor.visitClass(classNode)
+ return
+ }
+ scopeVisitor.prepareVisit(classNode)
+ if (methodNode.exceptions == null) {
+ // Groovy 5's VariableScopeVisitor reads the method's exceptions
array without a null check, and AST
+ // transforms routinely create methods via
ClassNode.addMethod(..., null, ...). MethodNode.exceptions is
+ // final, so recompute scopes on a proxy that shares the same
parameters and code but carries an empty
+ // exceptions array, then copy the computed scope back onto the
real method.
+ MethodNode proxy = new MethodNode(methodNode.name,
methodNode.modifiers, methodNode.returnType,
Review Comment:
You're saying the Groovy API is validating it's not null, and you can set
null in the create? I was suggesting we update all of our calls to not pass
null, which then would fix these work arounds.
--
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]