Inspectopedia Help

Possible heap pollution from parameterized vararg type

Reports methods with variable arity, which can be annotated as @SafeVarargs. The @SafeVarargs annotation suppresses unchecked warnings about parameterized array creation at call sites.

Example:

public class Foo<T> { private List<T> list = new ArrayList<>(); public final void safeVarargs(T... elements) { Collections.addAll(list, elements); } }
public class Foo<T> { private List<T> list = new ArrayList<>(); @SafeVarargs public final void safeVarargs(T... elements) { Collections.addAll(list, elements); } }

This annotation is not supported under Java 1.6 or earlier JVMs.

Inspection Details

By default bundled with:

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Java, 241.14841

Last modified: 12 March 2024