Consider this is given:
interface A<T> { /*...*/ }
interface B<T> extends A<T> { /*...*/ }
class C { /*...*/ }
void foo(A<T>... a) { /*...*/ }
Now, some other code wants to use foo
:
B<C> b1 /* = ... */;
B<C> b2 /* = ... */;
foo(b1, b2);
This gives me the warning
Type safety : A generic array of A is created for a varargs parameter
So I changed the call to this:
foo((A<C>) b1, (A<C>) b2);
This still gives me the same warning.
Why? How can I fix that?