O
odwl
Hi,
First, it seems to me that <T> is completely redundant with <T extends
Object>.
Indeed I can cast without warning List<T> and List<T extends Object> in
both way
Could someone confirm? Is that specifically said in the spec? Is that
really really equivalent?
Second, for the same reason, I also think that <?> is equivalent to <?
extends Object>.
Could someone confirm?
Third, the signature of the method Object.getClass() is:
Class<? extends Object> getClass().
Why they didn't write the following simple simple instead:
Class<?> getClass().
I know that there is a "trick" here in the sense that that methods does
not really return <? extends Object> but <? extends X> where X is the
erasure of the static type (as mentioned in the javadoc) so perhaps
they just choose <? extends X> because it is more "similar"!!
Could have they choose Class<?>. in place of Class<? extends Object>?
Was the choice made by chance?
Regards,
Olivier
First, it seems to me that <T> is completely redundant with <T extends
Object>.
Indeed I can cast without warning List<T> and List<T extends Object> in
both way
Could someone confirm? Is that specifically said in the spec? Is that
really really equivalent?
Second, for the same reason, I also think that <?> is equivalent to <?
extends Object>.
Could someone confirm?
Third, the signature of the method Object.getClass() is:
Class<? extends Object> getClass().
Why they didn't write the following simple simple instead:
Class<?> getClass().
I know that there is a "trick" here in the sense that that methods does
not really return <? extends Object> but <? extends X> where X is the
erasure of the static type (as mentioned in the javadoc) so perhaps
they just choose <? extends X> because it is more "similar"!!
Could have they choose Class<?>. in place of Class<? extends Object>?
Was the choice made by chance?
Regards,
Olivier