T array = new T[sz];, but erasure forgets about T so that's not legal. To solve the problem, you create an array of objects and cast it.
Stumbled on this while reviving two-year old code of mine, which was pretty 1.3-based. The code has not rotten all over and seems to be quite understandable. Let's do some generics to mess things up. ;)