Martin Funk wrote:
Foo<? extends Bar<?>> rawbar = new Foo<RawBar>(); // DOES NOT WORK - THIS IS CAUSING ONE HALF OF ALL OUR HEADACHESBtw, this does work (like you expect): Foo<? extends Bar<?>> rawbar2 = new Foo<SubBar<?>>();maybe some more wisdom can be found here:http://www.angelikalanger.com/GenericsFAQ/FAQSections/TechnicalDetails.html#FAQ209 In her words it would mean 'raw types are not part of the type family denoted by the wildcard parametrized type Bar<?>' But I'm still puzzled, since taking that FAQ it doesn't explain why in the case of the generic methodpublic <T extends Component<?>> void dol(Class<T> clazz) the raw types are all of a sudden member of that family
Nor does it explain why assignment: Bar<?> bar = new RawBar(); works, without errors or warnings...
the faq comes up with this:http://www.angelikalanger.com/GenericsFAQ/FAQSections/ParameterizedTypes.html#FAQ106and this:http://www.angelikalanger.com/GenericsFAQ/FAQSections/ParameterizedTypes.html#FAQ310
I find the argumentation rather mind-bending. And I still wonder how you can rationalize away that Foo.class returns a type that generates warnings if you want to use it!
Regards, Sebastiaan
smime.p7s
Description: S/MIME Cryptographic Signature