On Thu, 17 Dec 2020 10:45:17 GMT, Сергей Цыпанов
<[email protected]> wrote:
>> src/java.base/share/classes/java/util/Collections.java line 5589:
>>
>>> 5587: */
>>> 5588: @SafeVarargs
>>> 5589: @SuppressWarnings("varargs")
>>
>> I don't think you need a SuppressWarnings here
>
> Hi, without this I get failed build:
> Compiling 3057 files for java.base
> Compiling 89 properties into resource bundles for java.desktop
>
> return c.addAll(Arrays.asList(elements));
> ^
> error: warnings found and -Werror specified
> 1 error
> 1 warning
> make[3]: ***
> [/home/s.tsypanov/IdeaProjects/jdk-github/build/linux-x86_64-server-release/jdk/modules/java.base/_the.java.base_batch]
> Error 1
> CompileJavaModules.gmk:604: recipe for target
> '/home/s.tsypanov/IdeaProjects/jdk-github/build/linux-x86_64-server-release/jdk/modules/java.base/_the.java.base_batch'
> failed
> make[2]: *** [java.base-java] Error 2
> make[2]: *** Waiting for unfinished jobs....
> make/Main.gmk:193: recipe for target 'java.base-java' failed
ok, it means there is a bug in the compiler, the analysis done for unsafe
varargs (with -Xlint:varargs) doesn't check that the called method (here
Arrays.asList()) is tagged with @SafeVarargs.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1764