Re: Method chaining with generics
- From: "Hemal Pandya" <hemalpandya@xxxxxxxxx>
- Date: 31 Aug 2005 02:17:10 -0700
> Oliver Wong wrote:
> > "Hemal Pandya" <hemalpandya@xxxxxxxxx> wrote in message
> > news:1125423582.687861.85530@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> >
> >>Actually I don't quite understand why cast from List to List<Object> is
> >>a warning at all.
> >
> >
> > The warning says that the runtime environment can't actually tell
> > whether the cast succeeds or not (due to type erasure), so basically, the
> > code that you wrote down is not actually hapenning. I think that warrants a
> > warning.
> >
>
> I think your point is valid when dealing with List and List<Foo>, but
> Hemal was specifically referring to List<Object>. Is there any case
> when casting a List to List<Object> would cause a problem?
Yes, precisely. I considered if auto-boxing could cause a problem but
am unable to come up with an example.
This makes incremental migration of code from 1.4 to 5 rife with
warnings. Until I have migrated all my code and the third party code
has migrated to using generics.
The reason I like this warning better is that I can filter it out in
javac using "grep -v".
.
- References:
- Method chaining with generics
- From: iksrazal
- Re: Method chaining with generics
- From: Hemal Pandya
- Re: Method chaining with generics
- From: Oliver Wong
- Re: Method chaining with generics
- From: Raymond DeCampo
- Method chaining with generics
- Prev by Date: Re: Commenting in Java
- Next by Date: Re: how to detect a hard link in Java?
- Previous by thread: Re: Method chaining with generics
- Next by thread: Re: Method chaining with generics
- Index(es):
Relevant Pages
|
|