On Thu, 17 Dec 2020 11:07:55 GMT, Rémi Forax 
<github.com+828220+fo...@openjdk.org> wrote:

>> Should I then wait for the fix of that bug to remove `@SupressWarnings`?
>
> I don't think so, the code is fine, for me.

I've looked into `com.sun.tools.javac.comp.Check` and it seems the warning is 
produced here:
        @Override
        public void warn(LintCategory lint) {
            boolean warned = this.warned;
            super.warn(lint);
            if (warned) return; // suppress redundant diagnostics
            switch (lint) {
                case UNCHECKED:
                    Check.this.warnUnchecked(pos(), 
Warnings.ProbFoundReq(diags.fragment(uncheckedKey), found, expected));
                    break;
                case VARARGS:
                    if (method != null &&
                            method.attribute(syms.trustMeType.tsym) != null &&
                            isTrustMeAllowedOnMethod(method) &&
                            
!types.isReifiable(method.type.getParameterTypes().last())) {
                        Check.this.warnUnsafeVararg(pos(), 
Warnings.VarargsUnsafeUseVarargsParam(method.params.last()));
                    }
                    break;
                default:
                    throw new AssertionError("Unexpected lint: " + lint);
            }
        }
Can we somehow read `@SaveVarargs` from signature of `Arrays.asList()` to avoid 
the warning?

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

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

Reply via email to