Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #9096
| Newsgroups | comp.lang.java.programmer |
|---|---|
| From | Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> |
| Subject | Re: eclipse and un-generics |
| References | <slrnja0lhk.6gl.avl@gamma.logic.tuwien.ac.at> <j7q8ku$v5m$1@dont-email.me> |
| Message-ID | <slrnja6j0a.6gl.avl@gamma.logic.tuwien.ac.at> (permalink) |
| Date | 2011-10-22 23:04 +0000 |
Joshua Cranmer <Pidgeot18@verizon.invalid> wrote: > On 10/20/2011 12:11 PM, Andreas Leitgeb wrote: >> My attempt to use Class<?> as argument type in the implementing >> class failed, and I'm not sure I understand the deeper reasons of >> why this has to fail. I.e. why it doesn't just see it as an override >> instead of complaining about a bad overload. > While Class<?> is often treated as being the generic equivalent of > Class, they're not quite the same thing. Logically, "Class" means "a > class of anything", while "Class<?>" means "a class of some unknown type". I see the relevance for e.g. List<?> versus List where the former (unlike the latter) could not be add()ed an Object-typed item. I don't see, how it could make a difference for Class<?> versus Class, of which no method takes any "T"-typed arguments, nor do any methods of the "<T>"-parameterized return-value-types (like e.g. Constructor<T>). But then again, I do see, that the JLS just doesn't go that far into analysis of where <?> does make a difference, and where it doesn't. > Indeed, if anything, "Class" is probably closer in typing terms to > "Class<Object>", although there are a slew of special rules to account > for the fact that "Class<Object>" is probably very rarely meant. I'll try on Monday (to be sure), but I really don't expect (Class<Object> clazz) to be valid arguments for an overRIDE of a superclass's method taking (Class clazz). Anyway, I appreciate your response, making me aware that <?> isn't semantically the closest to the bare type, afterall.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar
eclipse and un-generics Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-10-20 17:11 +0000
Re: eclipse and un-generics Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-10-20 17:51 -0500
Re: eclipse and un-generics Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-10-22 23:04 +0000
csiph-web