MAKING THE FUTURE SAFE FOR THE PAST - ADDING GENERICITY TO THE JAVA(TM) PROGRAMMING LANGUAGE

Citation
G. Bracha et al., MAKING THE FUTURE SAFE FOR THE PAST - ADDING GENERICITY TO THE JAVA(TM) PROGRAMMING LANGUAGE, ACM SIGPLAN NOTICES, 33(10), 1998, pp. 183-200
Citations number
23
Categorie Soggetti
Computer Science Software Graphycs Programming","Computer Science Software Graphycs Programming
Journal title
Volume
33
Issue
10
Year of publication
1998
Pages
183 - 200
Database
ISI
SICI code
Abstract
We present GJ, a design that extends the Java programming language wit h generic types and methods. These are both explained and implemented by translation into the unextended language. The translation closely m imics the way generics are emulated by programmers: it erases all type parameters, maps type variables to their bounds, and inserts casts wh ere needed. Some subtleties of the translation are caused by the handl ing of overriding. GJ increases expressiveness and safety: code utiliz ing generic libraries is no longer buried under a plethora of casts, a nd 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-generi c to generic programming. In particular, one can retrofit existing lib rary classes with generic interfaces without changing their code. An i mplementation of GJ has been written in GJ, and is freely available on the web.