Inspectopedia Help

Iterable is used as vararg

Reports suspicious usages of Collection or Iterable in vararg method calls.

For example, in the following method:

<T> boolean contains(T needle, T... haystack) {...}

a call like

if(contains("item", listOfStrings)) {...}

looks suspicious as the list will be wrapped into a single element array. Such code can be successfully compiled and will likely run without exceptions, but it's probably used by mistake.

New in 2019.2

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Java, 233.SNAPSHOT

Last modified: 13 July 2023