Files
openide/java/java-impl/resources/inspectionDescriptions/IterableUsedAsVararg.html
2025-02-05 04:43:28 +00:00

18 lines
607 B
HTML

<html>
<body>
Reports suspicious usages of <code>Collection</code> or <code>Iterable</code> in vararg method calls.
<p>For example, in the following method:</p>
<pre><code>
&lt;T&gt; boolean contains(T needle, T... haystack) {...}
</code></pre>
<p>a call like</p>
<pre><code>
if(contains("item", listOfStrings)) {...}
</code></pre>
<p>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.</p>
<!-- tooltip end -->
<p><small>New in 2019.2</small></p>
</body>
</html>