mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
31 lines
852 B
HTML
31 lines
852 B
HTML
<html>
|
|
<body>
|
|
Reports methods with variable arity, which can be annotated as <code>@SafeVarargs</code>.
|
|
The <code>@SafeVarargs</code> annotation suppresses unchecked warnings about parameterized array creation at call sites.
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
public class Foo<T> {
|
|
private List<T> list = new ArrayList<>();
|
|
|
|
public final void safeVarargs(T... elements) {
|
|
Collections.addAll(list, elements);
|
|
}
|
|
}
|
|
</code></pre>
|
|
<p>After the quick-fix is applied:</p>
|
|
<pre><code>
|
|
public class Foo<T> {
|
|
private List<T> list = new ArrayList<>();
|
|
|
|
@SafeVarargs
|
|
public final void safeVarargs(T... elements) {
|
|
Collections.addAll(list, elements);
|
|
}
|
|
}
|
|
</code></pre>
|
|
<p>
|
|
This annotation is not supported under Java 1.6 or earlier JVMs.
|
|
</p>
|
|
<!-- tooltip end -->
|
|
</body>
|
|
</html> |