R. Cartwright et Gl. Steele, COMPATIBLE GENERICITY WITH RUN-TIME TYPES FOR THE JAVA(TM) PROGRAMMING LANGUAGE, ACM SIGPLAN NOTICES, 33(10), 1998, pp. 201-215
The most serious impediment to writing substantial programs in the Jav
a(TM) programming language is the lack of a genericity mechanism for a
bstracting classes and methods with respect to type. During the past t
wo years: several research groups have developed Java extensions that
support various forms of genericity, but none has succeeded in accommo
dating general type parameterization (akin to Java arrays) while retai
ning compatibility with the existing Java Virtual Machine. In this pap
er, we explain how to support general type parameterization-including
both non-variant and covariant subtyping-on top of the existing Java V
irtual Machine at the cost of a larger code footprint and the forwardi
ng of some method calls involving parameterized classes and methods. O
ur language extension is forward and backward compatible with the Java
1.2 language and run-time environment: programs in the extended langu
age will run on existing Java 1.2 virtual machines (relying only on th
e unparameterized Java core libraries) and all existing Java 1.2 progr
ams have the same binary representation and semantics (behavior) in th
e extended language.