Parametric polymorphism for Java: is there any hope in sight?

  • Authors:
  • Brian Cabana;Suad Alagić;Jeff Faulkner

  • Affiliations:
  • University of Southern Maine, Portland, ME;University of Southern Maine, Portland, ME;University of Southern Maine, Portland, ME

  • Venue:
  • ACM SIGPLAN Notices
  • Year:
  • 2004

Quantified Score

Hi-index 0.00

Visualization

Abstract

In spite of years of research toward a solution for the problem of extending Java with parametric polymorphism (genericity) the officially accepted solution already in its beta release allows violation of the Java type system and turns a type safe language into an unsafe one. The run-time type information in this release is incorrect which leads to major problems for the programmers relying on the Java reflective capabilities. We show that there are two basic reasons for these problems. The first one is that the idiom underlying this solution is provably incorrect. The second one is that the problem of extending Java with parametric polymorphism does not have a correct solution unless the Java Virtual Machine is extended to handle it properly. This paper elaborates the subtleties required by a correct implementation technique that includes representation of parametric classes in the standard Java class file format, representation of the instantiated parametric class objects, extensions of the Java Core Reflection to report type information about (instantiated) parametric classes, and the loading techniques required by this solution for extending Java with generics. Previous solutions for this problem are analyzed as well.