Given the following source listing, explain why the compiler is producing a warning at invocation to the list method and give a solution for removing the warning without resorting to @SuppressWarnings annotation.
public class JavaLanguagePuzzle3
{
public static void main( String[] args )
{
list( "1", 2, new BigDecimal( "3.5" ) );
}
private static <T> List<T> list( T... items )
{
return Arrays.asList( items );
}
}
Warning:
Type safety: A generic array of Object&Serializable&Comparable<?> is created for a varargs parameter