Hello!

I'm currently writing a little Java-game which makes use of the Reflection API to dynamically load objects at runtime.
This setup makes it a lot easier for me to work with the objects as I do not need to hard-code them into the game each time a new is created. If I create a new enemy I put it in the enemy-package, and it is ready for the game.

However, until now I've been using raw Class-instances for this, but I want to rid my code of all of Eclipse's Warnings. I can however not manage to do this in a safe way. How do the Class-class actually work?

Here are some problems I have (code + warning):

Java Code:
Class<Splinter>[] c = new Class<Splinter>[] { SubclassOfSplinter.class, SubclassOfSplinter2.class };
Warning: "Type mismatch: cannot convert from Class<SubclassOfSplinter> to Class<Splinter>"



Java Code:
Class<? extends Splinter>[] c = new Class<? extends Splinter>[] { SubclassOfSplinter.class, SubclassOfSplinter2.class };
Warning: "Cannot create a generic array of Class<? extends Splinter>"



Java Code:
Class<? extends Tile> c = (Class<? extends Tile>)Class.forName("tiles." + tokens[0]);
Warning: "Type safety: Unchecked cast from Class<capture#2-of ?> to Class<? extends Tile>"



Is there a way to solve these warnings and errors?
Is it possible to create an array of Splinter-type Classes which can include sub-classes of Splinter as well?
(I want to get rid of as much of the casting and unchecked warnings as possible)


Thanks in advance / Komposten