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?
Help get this topic noticed by sharing it on Twitter, Facebook, or email.
That's a great question for one of our Book Tech staff to look into. I'll get your question over to them to review. You can also reach them directly for any other questions you may have about the book at firstname.lastname@example.org.
O'Reilly Media Customer Service Team