Jump to content

Heap pollution

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mark viking (talk | contribs) at 19:04, 15 July 2014 (Removed unreferenced tag). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In Java programming language, type arguments and variables are not reified at run-time. As a result, different parameterized types are implemented by the same class or interface at run time. Indeed, all invocations of a given generic type declaration share a single run-time implementation. This results in the possibility of heap pollution.[1]

Under certain conditions, it is possible that a variable of a parameterized type refers to an object that is not of that parameterized type. The variable will always refer to an object that is an instance of a class that implements the parameterized type.

Reference

  1. ^ Langer, Angelika. "Java Generics FAQs: Heap pollution". http://www.angelikalanger.com/. Retrieved 15 July 2014. {{cite web}}: External link in |website= (help)