mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-27 01:42:17 +07:00
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
27 lines
623 B
HTML
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<Number> list) {
|
|
Number[] ns = list.toArray(new String[0]);
|
|
}
|
|
</code></pre>
|
|
|
|
|
|
</body>
|
|
</html> |