You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/08/26 23:15:12 UTC

[GitHub] [netbeans] mbien commented on a diff in pull request #4537: Cleanup clone usage

mbien commented on code in PR #4537:
URL: https://github.com/apache/netbeans/pull/4537#discussion_r956491162


##########
contrib/groovy.grails/test/unit/src/org/netbeans/modules/groovy/grails/api/GrailsRuntimeTest.java:
##########
@@ -106,7 +106,7 @@ public void testCommandDescriptor() throws IOException {
         desc.getProps().setProperty("wrong", "wrong");
         assertEquals(props, desc.getProps());
 
-        String[] correctArgs = args.clone();
+        String[] correctArgs = new ArrayList<String>.toArray(args);

Review Comment:
   this doesn't compile since the `()` is missing. But what worse is that this is wrong. It would create an empty AL and copy `null` into the first element of `args` to mark the end of the (empty) array.
   
   please use `Arrays.copyOf(args, args.length)` for example. Same applies to the other occurrences.



-- 
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-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists