Campbell Ritchie wrote:Angelika Langer Java generics FAQ.
Jeff Verdegan wrote:It doesn't look at the = new ArrayList<Number>() part.
Paul Witten wrote:
Jeff Verdegan wrote:It doesn't look at the = new ArrayList<Number>() part.
You mean it doesn't look "back" after the assignment/declaration is over, Jeff? It seems incomprehensible that an assignment during declaration is not checked.
When determining what kind of List it is when we go to use it, that's all the compiler knows and cares about. It doesn't look at the = new ArrayList<Number>() part.
Jeff Verdegan wrote:
Paul Witten wrote:
Jeff Verdegan wrote:It doesn't look at the = new ArrayList<Number>() part.
You mean it doesn't look "back" after the assignment/declaration is over, Jeff? It seems incomprehensible that an assignment during declaration is not checked.
Maybe. I meant exactly what I said.
When determining what kind of List it is when we go to use it, that's all the compiler knows and cares about. It doesn't look at the = new ArrayList<Number>() part.
Maybe the two underlined parts being in different sentences obscured the fact that they're part of the same overall assertion.
As for "looking back," I'm not a compiler guy, so I don't know the order in which various analyses and validations are done, and as far as the point I was making, it's irrelevant. Yes, it has to check that assignment, but that is completely independent of anything else we do with that list.
Prakash Rai wrote:
I Understand Something but I am very much very sure about this...I have gone through suggested posts by all of you but even I need bit clear solution. What Should I do in order to solve that?