The answer has to do with Array Creation Expression.
The rule clearly states:
The rules above imply that the element type in an array creation
expression cannot be a parameterized type, other than an unbounded
wildcard.
That's why your above code will never compile. In fact, the following compile-time error message shows (example):
/**
*
*/
/**
* @author The Elite Gentleman
*
*/
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Class<? extends Exception>[] classes = new Class<? extends Exception>[5];
}
}
Test.java:17: generic array creation
Solution (that works, if you follow the above rule):
Class<? >[] classes = new Class<?>[5];
The above line compiles.
I hope this helps.