Obviously MarkupContainer<Object> satisfies the MarkupContainer<?> in a method argument, so it accepts the raw type. However, it generates a warning because the method says it's generified, so you should be using the generic type.
Johan Compagner wrote:
I dont care, because i cant do any thing with the ? The only thing it enforces is that it must now be a generic class which is annoying. Not to mention that in that area eclipse and javac accept different things....
The reason it warns you to use generics when generics are wanted is because Sun wants to be able to make it *required* (in a future release) to use generics where generics are wanted; at least, so I read... I think in the real world they wouldn't dare to do this because it would piss off so many users and break so much stuff. :-)
But the idea is that if something is generified you should be using a type parameter, and using a raw type is *purely* for backwards compatibility with legacy code.
Regards, Sebastiaan
So or we in wicket dont use <?> any where and have supress warning everywhere for that or we do use it and then suddenly it is in my eyes restricted to much.
I don't understand
On 5/14/08, Sebastiaan van Erk <[EMAIL PROTECTED]> wrote:Johan Compagner wrote:yes thats the reason you are calling the method add with a generified component but that container itself is not generified i dont like this about generics expecially the onces like this: add(MarkupContainer<?> container) then suddenly a none generified component cant be added... thats really stupid <?> should mean anything.. including none genericsNo, that's not correct. For example, List<?> is much more restrictive than a raw List (which is a List<Object>). To a raw list you can add an instance of any type whatever, i.e., list.add(new Object()). But in List<?> the ? is a wildcard which says it could be any type there, i.e., it could be a List<Integer>. But you can't add a new Object() to a List<Integer>! Thus MarkupContainer<?> means "MarkupContainer parameterized by some unknown type", and *not* MarkupContainer parameterized by Object, which is what the raw type means. Regards, Sebastiaanjohan On Tue, May 13, 2008 at 5:55 PM, Stefan Simik <[EMAIL PROTECTED]> wrote:I have one idea, the reason of the warnigs is, that parent of AjaxPagingNavigator is PagingNavigator, which has parent Panel ---> that is not parameterized. The same problem is with LoopItem, which extends the WebMarkupContainer ---> that is not parameterized. ? could this be the reason ? Stefan Simik wrote:Mhmm, it is meaningful ;) I will know in future, thx One of the last occuring warning is, when working with MarkupContainer#add(...) or #addOrReplace(...) method. Example: I have a simple AjaxPagingNavigator, to which I add a simple ListView ----------------------------------------------------------------------- ListView<Integer> menu = new ListView<Integer>("id", numbers){ //....populate metods } add(menu); //warning here The warning says: "Type safety: The method add(Component...) belongs to the raw type MarkupContainer. References to generic type MarkupContainer<T> should be parameterized" I cannot find out, what's the warning reason, because ListView self is parameterized.-- View this message in context:http://www.nabble.com/Using-generics-with-some-non-generic-classes-in-Wicket-tp17208928p17212015.htmlSent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
smime.p7s
Description: S/MIME Cryptographic Signature