Making the future safe for the past: adding genericity to the Java programming language

Gilad Bracha, Martin Odersky, David Stoutamire, Philip Wadler

Research output: Chapter in Book/Report/Conference proceedingConference contribution

Abstract / Description of output

We present GJ, a design that extends the Java programming language with generic types and methods. These are both explained and implemented by translation into the unextended language. The translation closely mimics the way generics are emulated by programmers: it erases all type parameters, maps type variables to their bounds, and inserts casts where needed. Some subtleties of the translation are caused by the handling of overriding. GJ increases expressiveness and safety: code utilizing generic libraries is no longer buried under a plethora of casts, and the corresponding casts inserted by the translation are guaranteed to not fail. GJ is designed to be fully backwards compatible with the current Java language, which simplifies the transition from non-generic to generic programming. In particular, one can retrofit existing library classes with generic interfaces without changing their code. An implementation of GJ has been written in GJ, and is freely available on the web.
Original languageEnglish
Title of host publicationOOPSLA '98 Proceedings of the 13th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications
Place of PublicationNew York, NY, USA
PublisherACM
Pages183-200
Number of pages18
ISBN (Print)1-58113-005-8
DOIs
Publication statusPublished - 1998

Fingerprint

Dive into the research topics of 'Making the future safe for the past: adding genericity to the Java programming language'. Together they form a unique fingerprint.

Cite this