Back to Intellij Community

SafeVarargsHasNoEffect

java/java-impl/resources/inspectionDescriptions/SafeVarargsHasNoEffect.html

2025.3-rc-2381 B
Original Source

Reports write operations inside @SafeVarargs methods where vararg parameter is reassigned to something else. In this case, newly assigned array is not related to the variable arity arguments at the call site and might not be safe anymore.

Example:

@SafeVarargs
    public final <T> void test(T[] tt, T... t) {
        t = tt;
        System.out.println(t[0]);
    }