RFR: 8193031: Collections.addAll is likely to perform worse than Collection.addAll

Pavel Rappo prappo at openjdk.java.net
Mon Dec 21 11:34:57 UTC 2020


On Sat, 19 Dec 2020 09:09:50 GMT, Guoxiong Li <github.com+13688759+lgxbslgx at openjdk.org> wrote:

>> Apart from the @SuppressWarnings, this looks good to me.
>> And i like the irony of this.
>
> Hi all,
> 
> According to the document of [SafeVarargs](https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/SafeVarargs.html).
> 
>> Compilers are encouraged to issue warnings when this annotation type is applied to a method or constructor declaration where:
> 
>> The body of the method or constructor declaration performs potentially unsafe operations, such as an assignment to an element of the variable arity parameter's array that generates an unchecked warning. 
> 
> The `SafeVarargs` may not suppress the warning of this assignment and the `SuppressWarnings` may be necessary.
> 
> If you still think it is the bug of compiler. I suggest that you move the bug discussion to the compiler-dev at openjdk.java.net to solve the bug as soon as possible.

This message is purely informational: I may have found a JBS comment that provides historical context for that "this method is likely to run significantly faster under most implementations" phrase. Here: https://bugs.openjdk.java.net/browse/JDK-4822887?focusedCommentId=12241154&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-12241154

-------------

PR: https://git.openjdk.java.net/jdk/pull/1764


More information about the core-libs-dev mailing list