I'm still trying to get my head around using Java's generics. I have no problems at all with using typed collections, but much of the rest of it just seems to escape me.
Right now I'm trying to use the JUnit "PrivateAccessor", which requires a Class[] argument with a list of all the argument types for the private method being called. In Java 1.4, I'd define that as
Class[] args = new Class[] { Collection.class, ArrayList.class };
but the actual code is defined to now take the arguments
myMethod(Collection<MyClass1> first, ArrayList<MyClass2> second)
I tried to change the definition of args to be
Class<? extends Object>[] args = new Class<? extends Object>[]
{ Collection<MyClass1>.class, ArrayList<MyClass2>.class };
But Eclipse puts a red marker on the closing >s, and says it's expecting "void" at that point. Can I do this using generics, or shouldn't I bother?