Help get this topic noticed by sharing it on Twitter, Facebook, or email.

generics, arrays and reflection

Hi, I was reading Java Generics and collections by Maurice Naftalin & Philip Wadler. I have been puzzled (and tried to search help, but couldn't any match) with these sentences on page 102 regarding reflection, arrays and generics..

Unchecked casts are required because the methods in the Java reflection library cannot return sufficiently accurate types, for various reasons. The method getComponentType is in the class Class, and java provides no way to restrict the receiver type to be class in the signature of the method (though the call raises an exception if the receiver is not a class token for an array type)

Probably something quite easy, but expressed in quite tricky way, any idea?
1 person has
this question
+1
Reply