Take the following:
public Class<List<String>> getObjectType() {
// what can I return here?
}
What class literal expression can I return from this method which will satisfy the generics and compile? List.class
won't compile, and neither will List.<String>class
.
If you're wondering "why", I'm writing an implementation of Spring's FactoryBean<List<String>>
, which requires me to implement Class<List<String>> getObjectType()
. However, this is not a Spring question.
edit: My plaintive cries have been heard by the powers that be at SpringSource, and so Spring 3.0.1 will have the return type of getObjectType()
changed to Class<?>
, which neatly avoids the problem.