BradWalker commented on code in PR #5524:
URL: https://github.com/apache/netbeans/pull/5524#discussion_r1110222572
##########
ide/editor/demosrc/base/org/netbeans/editor/example/Editor.java:
##########
@@ -544,7 +544,7 @@ private String[] getOpenedFiles() {
}
}
- return (String []) opened.toArray(new String[opened.size()]);
+ return opened.toArray(new String[0]);
Review Comment:
> toArray() method have autosize operation on jvm side. You can check inside.
Sure it does.. But, the writer of the software expressly requested a
pre-allocated String as an argument. This changes the intent of that work.
Also, I don't really like to think about the internals. I like to think about
what the author wanted done, which in this case is to expressly pre-allocate a
String.
I would get rid of the cast and nothing more.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists