[
https://issues.apache.org/jira/browse/LUCENE-8165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16500492#comment-16500492
]
Adrien Grand edited comment on LUCENE-8165 at 6/4/18 4:39 PM:
--------------------------------------------------------------
bq. I think our code will be more clear and less error-prone with these helper
methods.
+1 I was going to suggest something like that too. I understand why someone
would like the explicitness of System.arraycopy, but I miss the type safety and
conciseness of Arrays.copyOf/copyOfRange. Maybe call the second method that you
suggested something like {{copyOfSubArray}} to be more explicit about the fact
that it is a copy?
was (Author: jpountz):
bq. I think our code will be more clear and less error-prone with these helper
methods.
+1 I was going to use something like that too. I understand why someone would
like the explicitness of System.arraycopy, but I miss the type safety and
conciseness of Arrays.copyOf/copyOfRange. Maybe call the second method that you
suggested something like {{copyOfSubArray}} to be more explicit about the fact
that it is a copy?
> ban Arrays.copyOfRange with forbidden APIs
> ------------------------------------------
>
> Key: LUCENE-8165
> URL: https://issues.apache.org/jira/browse/LUCENE-8165
> Project: Lucene - Core
> Issue Type: Bug
> Reporter: Robert Muir
> Priority: Major
> Attachments: LUCENE-8165_copy_of.patch,
> LUCENE-8165_copy_of_range.patch, LUCENE-8165_start.patch,
> LUCENE-8165_start.patch
>
>
> This method is no good, because instead of throwing AIOOBE for bad bounds, it
> will silently fill with zeros (essentially silent corruption). Unfortunately
> it is used in quite a few places so replacing it with e.g. arrayCopy may
> uncover some interesting surprises.
> See LUCENE-8164 for motivation.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]