File APIs for Java Developers The moose likes Performance and
the fly likes Heap Pollution Big Moose Saloon   Search | Java
FAQ | Recent Topics Register / Login JavaRanch » Java Forums »
Java » Performance Reply Bookmark "Heap Pollution" Watch "Heap
Pollution" New topic  Heap Pollution  Anirudh Vyas Ranch Hand
Joined: Oct 23, 2006 Posts: 93  I was looking through JLS 3rd
edition and found this interesting topic :  Heap Pollution  Can
someone give a clear but ellaborate example in context of
exactly what happens or what is meant by heap pollution?
meaning, as the JLS says : so if I've got:  List l = new
ArrayList<Number>(); List<String> ls = l; // cause unchecked
warning (as said in JLS, but i am thinking above statement would
also give a warning, since its a raw type).  JLS goes on to say
that : This would cause heap pollution because you cannot infer
the type at compile time and runtime, my question is, so if we
cannot infer the type, then what? how does it affect the heap?
Sorry if the question sounds dum