Files
openide/java/java-impl/resources/inspectionDescriptions/SuspiciousToArrayCall.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

27 lines
623 B
HTML

<html>
<body>
Reports suspicious calls to <code>Collection.toArray()</code>.
<p>The following types of calls are considered suspicious:</p>
<ul>
<li>
when the type of the array
argument is not the same as the array type to which the result is casted.
</li>
<li>
when the type of the array argument does not match the type parameter in the collection declaration.
</li>
</ul>
<p><b>Example:</b></p>
<pre><code>
void m1(List list) {
Number[] ns = (Number[]) list.toArray(new String[0]);
}
void m2(List&lt;Number&gt; list) {
Number[] ns = list.toArray(new String[0]);
}
</code></pre>
</body>
</html>