taken from SUN's generic tutorial:
http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf
end of page 8
snip :::
interface Collection
{
public boolean containsAll(Collection c);
public boolean addAll(Collection c);
}
We could have used generic methods here instead:
interface Collection
{
p
this one will do:
public > void foo(Class clazz);
however, the subtle differences between this and igors version are
really hard to get.
Am 15.05.2008 um 16:31 schrieb Igor Vaynberg:
this is the usecase we are talking about. i get a compile error,
which sucks.
public class Test
{
yes and those i already came across some in wicket
i changed to and suddenly in extentions and/or examples compile errors
all over the place...
then i quickly turn it off again... (for now)
johan
On Thu, May 15, 2008 at 4:31 PM, Igor Vaynberg <[EMAIL PROTECTED]>
wrote:
> this is the usecase we
this is the usecase we are talking about. i get a compile error, which sucks.
public class Test
{
public static void main(String[] args)
{
Foo foo = new FooImpl();
foo.foo(IntegerComponent.class); // ok
foo.foo(Component.class); // compile error
}
public st
Igor Vaynberg wrote:
well, apparently johan ran into a situation where component is too
restrictive...
As I understand it, Johan ran into a situation where Component causes
*warnings* for users who use raw types. Which I've been arguing all
along that they SHOULD get: they should use Componen
i think something similar happend to me with Model.valueOf(Map), so
i had to change it back to return Model instead of Model
Gerolf
On Wed, May 14, 2008 at 11:41 PM, Igor Vaynberg <[EMAIL PROTECTED]>
wrote:
> well, apparently johan ran into a situation where component is too
> restrictive...
>
well, apparently johan ran into a situation where component is too
restrictive...
-igor
On Wed, May 14, 2008 at 2:37 PM, Sebastiaan van Erk <[EMAIL PROTECTED]> wrote:
> Igor Vaynberg wrote:
>>
>> since then the thread has evolved into whether or not we should use > extends Component> or >
>>
>>
yeah, generics are pretty damn viral
-igor
On Wed, May 14, 2008 at 2:28 PM, Eelco Hillenius
<[EMAIL PROTECTED]> wrote:
> On Wed, May 14, 2008 at 2:25 PM, Eelco Hillenius
> <[EMAIL PROTECTED]> wrote:
>>> the whole generics thing turned out to be
>>> quiet a lot crappier then i thought it would.
>>
Igor Vaynberg wrote:
since then the thread has evolved into whether or not we should use or >
-igor
I don't understand how that changes any of my points. The first is
incorrect (from a generics point of view) since you're referencing an
unparameterized generic type.
So the second gives wa
wicket 1.6 = scala-based ? *lol*
Am 14.05.2008 um 23:28 schrieb Eelco Hillenius:
On Wed, May 14, 2008 at 2:25 PM, Eelco Hillenius
<[EMAIL PROTECTED]> wrote:
the whole generics thing turned out to be
quiet a lot crappier then i thought it would.
:-)
Generics for models: great. Generics for
On Wed, May 14, 2008 at 2:25 PM, Eelco Hillenius
<[EMAIL PROTECTED]> wrote:
>> the whole generics thing turned out to be
>> quiet a lot crappier then i thought it would.
>
> :-)
Generics for models: great. Generics for components: awful. Too bad
that stuff is contagious.
Eelco
--
since then the thread has evolved into whether or not we should use or >
-igor
On Wed, May 14, 2008 at 1:54 PM, Sebastiaan van Erk <[EMAIL PROTECTED]> wrote:
> Igor Vaynberg wrote:
>
>> i do like generics. did i ever say otherwise? the problem here is that
>> if we scope something as Class then
> the whole generics thing turned out to be
> quiet a lot crappier then i thought it would.
:-)
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Igor Vaynberg wrote:
i do like generics. did i ever say otherwise? the problem here is that
if we scope something as Class then even though
you ARE using generics in your code you will still get a warning
because we did not scope the class as Class>.
on the other hand if we do scope it as Class
MarkupContainer.
References to generic type MarkupContainer 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-ge
(which is a List). To a raw list you can
>>>>>
>>>>> add an
>>>>>>>>>
>>>>>>>>> instance of any type whatever, i.e., list.add(new Object()). But
>>>
>>> in
>>>>>>>>>
>>>>>>&g
; List!
>>>>>>> >
>>>>>>> > Thus MarkupContainer means "MarkupContainer parameterized by
>>>>
>>>> some
>>>>>>>
>>>>>>> > unknown type", and *not* MarkupContainer param
t 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.html
Sent from the Wicket - User mailing list archive at
Nabble.com.
; >> > > is what the raw type means.
>> >> >> > >
>> >> >> > > Regards,
>> >> >> > > Sebastiaan
>> >> >> > >
>> >> >> > > > johan
>> >> >&g
> >
> >> >> > > >> I have one idea,
> >> >> > > >>
> >> >> > > >> the reason of the warnigs is, that parent of
> AjaxPagingNavigator
&g
--
> >>> ListView menu = new ListView("id", numbers){
> >>> //populate metods
> >>> }
> >>> add(menu);//warning here
> >>>
> >>> The warning says:
> >>> "Type safety: T
parameterized.
>> >> > > >>
>> >> > > >> The same problem is with LoopItem, which extends the
>> >> > > >> WebMarkupContainer ---> that is not parameterized.
>> >> > > >>
>> >> > >
e
> >> > > >> WebMarkupContainer ---> that is not parameterized.
> >> > > >>
> >> > > >> ? could this be the reason ?
> >> > > >>
> >> > > >>
> >> > > >>
> >> > >
; >>
>> > > >>
>> > > >>
>> > > >>
>> > > >> Stefan Simik wrote:
>> > > >>> Mhmm, it is meaningful ;) I will know in future, thx
>> > > >>>
>> > > >>> One o
rameterized.
>>> >> >>
>>> >> >> ? could this be the reason ?
>>> >> >>
>>> >> >>
>>> >> >>
>>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> Stefan Simik wrote:
>> >> >> >
>> >> >> > Mhmm, it is meaningful ;) I will know in f
> >> generics", I
> >> respectfully disagree. One major point of generics is to avoid code
> >> duplication of boilerplate code. It it weren't for the need to
> >> create
> >> constructors, there wouldn't be any duplicated code. I
>> >> >
> >> >> > One of the last occuring warning is, when working with
> >> >> > MarkupContainer#add(...) or #addOrReplace(...) method.
> >> >> >
> >> >> > Example: I have a simple AjaxPagingNavig
;> >> >
>> >> > The warning says:
>> >> > "Type safety: The method add(Component...) belongs to the raw type
>> >> > MarkupContainer.
>> >> > References to generic type MarkupContainer sho
gt;> generics", I
>> respectfully disagree. One major point of generics is to avoid code
>> duplication of boilerplate code. It it weren't for the need to
>> create
>> constructors, there wouldn't be any duplicated code. I agree that
>> it i
te:
imho, that seems like that adds a lot of unnecessary code. One of the
nice things about Wicket is that it keeps the bloat to a minimum.
-Original Message-
From: Doug Donohoe [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 14, 2008 8:21 AM
To: users@wicket.apache.org
Subject: Re: Using generics
readability and
maintainability.
-Doug
Hoover, William wrote:
>
> imho, that seems like that adds a lot of unnecessary code. One of the
> nice things about Wicket is that it keeps the bloat to a minimum.
>
> -Original Message-----
> From: Doug Donohoe [mailto:[EMAIL PROTECTED]
t; >> > > > > PagingNavigator,
> >> > > > > which has parent Panel ---> that is not parameterized.
> >> > > > >
> >> > > > > The same problem is with LoopItem, which extends the
> >> > > > >
generics with some non-generic classes in Wicket
Somewhat related to this thread, when I moved to generics win Wicket
1.4, I created some utility classes such as:
public class VoidContainer extends WebMarkupContainer<Void> public
class VoidPanel extends Panel<Void> public class StringL
gt; simple
>> > > > > > ListView
>> > > > > >
>> > > > > >
>> ---
>> > > > > > ListView menu = new ListView("id", numbers){
>>
future, thx
> > > > > >
> > > > > > One of the last occuring warning is, when working with
> > > > > > MarkupContainer#add(...) or #addOrReplace(...) method.
> > > > > >
> > > > > > Example: I
rized"
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.html
Sent from the Wicket - User mailing list archive at Nabble.com
;
> > > >>> 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
View
> > >>> -----------------------
> > >>> ListView menu = new ListView("id", numbers){
> > >>> //populate metods
> > >>> }
> > >>> add(menu);//warning here
> >>> ListView menu = new ListView("id", numbers){
> >>> //....populate metods
> >>> }
> >>> add(menu);//warning here
> >>>
> >>> The
ys:
"Type safety: The method add(Component...) belongs to the raw type
MarkupContainer.
References to generic type MarkupContainer should be parameterized"
I cannot find out, what's the warning reason, because ListView self is
parameterized.
--
View this message in context:
http://ww
this.stringProvider = stringProvider;
> >> >> }
> >> >>
> >> >> public ExtendedLabel(String id, String text) {
> >> >>this(id, new Model(text), new BasicStringProvider());
> >> >>//this(id, new Model<T>(text), new
>
ringProvider;
>> >> }
>> >>
>> >> public ExtendedLabel(String id, String text) {
>> >>this(id, new Model(text), new BasicStringProvider());
>> >>//this(id, new Model<T>(text), new
>> BasicStringProvider()
le
> >> > ListView
> >> >
> ---
> >> > ListView menu = new ListView("id", numbers){
> >> > //populate metods
> >> > }
> >> > add(menu);
ate metods
>> > }
>> > add(menu);//warning here
>> >
>> > The warning says:
>> > "Type safety: The method add(Component...) belongs to the raw type
>> > MarkupContainer.
>> > References to generic type MarkupCont
ent...) belongs to the raw type
> > MarkupContainer.
> > References to generic type MarkupContainer should be parameterized"
> >
> > I cannot find out, what's the warning reason, because ListView self is
> > parameterized
the second constructor, which calls this. Its
> >> second parameter - "new Model(text)",
> >>
> >> which I cannot generify. If I write "new Model(text)", I get an error:
> >> "The
> >> constructor Model(String) is undefined."
rror
>> }
>>
>> }
>>
>>
>>
>>
>> The problematic part, is the second constructor, which calls this. Its
>> second parameter - "new Model(text)",
>>
>> which I cannot generify. If I write "new Model(text)",
omponent...) belongs to the raw type
> MarkupContainer.
> References to generic type MarkupContainer should be parameterized"
>
> I cannot find out, what's the warning reason, because ListView self is
> parameterized.
>
>
--
View this message in context:
http:/
e 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-tp17208928p17211948.html
Sent from the Wicket - User mailing l
his
> >
> > public ExtendLabel(String id, T string)
> > {
> > super(id, new Model(string));
> > }
> >
>
> --
> View this message in context:
> http://www.nabble.com/Using-generics-with-some-non-generic-classes-
public ExtendLabel(String id, T string)
> {
> super(id, new Model(string));
> }
>
--
View this message in context:
http://www.nabble.com/Using-generics-with-some-non-generic-classes-in-Wicket-tp17208928p17211220.html
Sent from the Wicket - User mailing li
Its
> second parameter - "new Model(text)",
>
> which I cannot generify. If I write "new Model(text)", I get an error:
> "The
> constructor Model(String) is undefined."
>
>
> I can't find out, what I am doing wrong.
>
>
> Thx
>
"new Model(text)", I get an error: "The
constructor Model(String) is undefined."
I can't find out, what I am doing wrong.
Thx
Stefan Simik
--
View this message in context:
http://www.nabble.com/Using-generics-with-some-non-generic-classes-in-Wicket-tp17208
g of these classes ?
>
> Thx,
> Stefan Simik
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Using-generics-with-some-non-generic-classes-in-Wicket-tp17208928p17208928.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
&
fying of these classes ?
Thx,
Stefan Simik
--
View this message in context:
http://www.nabble.com/Using-generics-with-some-non-generic-classes-in-Wicket-tp17208928p17208928.html
Sent from the Wicket - User mailing list archive at Nabbl
56 matches
Mail list logo