Jump to content

Heap pollution

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Anwar saadat (talk | contribs) at 18:07, 24 January 2008. 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 type 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.

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.