how to declare Class.class with valid generics
Note: purely out of curiosity and not for any actual use case. I'm wondering if there is a way to declare the Class Class object with valid type parameters: Class cc1 = Class.class; //raw type Class<Class> cc2 = Class.class; //now parameter is raw type Class<Class<?>> cc3 = Class.class; //compile error: inconvertible types If Class and Class<?> are interchangeable, why are Class<Class> and Class<Class<?>> not? EDIT: the question can be generalized to an issue of nested raw type parameters. For example: ArrayList<ArrayList<?>> lst = new ArrayList<ArrayList>(); //same compile error EDIT2: I