Possible duplicate:
Is it possible to solve the problem? Is the generated array T created for the varargs parameter? Compiler Warning?
We believe that this is given:
interface A<T> { } interface B<T> extends A<T> { } class C { } void foo(A<T>... a) { }
Now another code wants to use foo :
B<C> b1 ; B<C> b2 ; foo(b1, b2);
It gives me a 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);
It still gives me the same warning.
Why? How can i fix this?
java casting variadic-functions
Albert
source share