[ 
https://issues.apache.org/jira/browse/GROOVY-12276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18105727#comment-18105727
 ] 

ASF GitHub Bot commented on GROOVY-12276:
-----------------------------------------

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.





> further Closure hardening under readResolve
> -------------------------------------------
>
>                 Key: GROOVY-12276
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12276
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>
> do the same treatment we did previously for Closure on ComposedClosure and 
> TrampolineClosure



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to