The simplest way is to not use arrays. Arrays are not fully typechecked at compile time:
Number[] numbers=new Integer[1];
numbers[0]=5.0; //ArrayStoreException
That's the main reason why they're incompatible with generics.
If you're absolutely convinced that using arrays is what you want, use the factory
pattern.
interface ArrayFactory<T>
{
T[] instance();
}
public <T> void doSomething(ArrayFactory<T> factory)
{
System.out.println(factory.instance());
}
Obviously this isn't a useful example.
In my opinion, Java 5 wasn't fit for release while there were generics warnings from classes such as ArrayList.