Copilot commented on code in PR #2813:
URL: https://github.com/apache/groovy/pull/2813#discussion_r3809048711
##########
src/main/java/groovy/lang/Closure.java:
##########
@@ -1480,6 +1482,33 @@ protected static void checkForReferenceCycle(final
Closure<?> root) throws Inval
}
}
+ private static Object[] concat(final Object[] first, final Object[]
second) {
+ if (second.length == 0) return first;
+ final Object[] joined = new Object[first.length + second.length];
Review Comment:
`concat` assumes `second` is non-null (`second.length`). While
`additionalReferences()` documents that it never returns null, this is a
protected API and an accidental null override would turn deserialization
validation into a confusing `NullPointerException`. Consider treating `null` as
“no additional references” for robustness.
--
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]