The most serious impediment to writing substantial programs in the Java™ programming language is the lack of a gentricity mechanism for abstracting classes and methods with respect to type. During the past two years, several research groups have developed Java extensions that support various forms of genericity, but none has succeeded in accommodating general type parameterization (akin to Java arrays) while retaining compatibility with the existing. Java Virtual Machine. In this paper, we explain how to support general type parameterization---including both non-variant and covariant subtyping---on top of the existing Java Virtual Machine at the cost of a larger code footprint and the forwarding of some method calls involving parameterized classes and methods. Our language extension is forward and backward compatible with the Java 1.2 language and run-time environment: programs in the extended language will run on existing Java 1.2 virtual machines (relying only on the unparameterized Java core libraries) and all existing Java 1.2 programs have the same binary representation and semantics (behavior) in the extended language.
[1]
Mads Torgersen.
Virtual types are statically safe
,
1998
.
[2]
Stephen N. Freund,et al.
Adding type parameterization to the Java language
,
1997,
OOPSLA '97.
[3]
Kresten Krab Thorup.
Genericity in Java with Virtual Types
,
1997,
ECOOP.
[4]
Martin Odersky,et al.
Making the future safe for the past: adding genericity to the Java programming language
,
1998,
OOPSLA '98.
[5]
Bertrand Meyer,et al.
Eiffel: The Language
,
1991
.
[6]
John C. Mitchell,et al.
F-bounded polymorphism for object-oriented programming
,
1989,
FPCA.
[7]
Martin Odersky,et al.
Pizza into Java: translating theory into practice
,
1997,
POPL '97.
[8]
Andrew C. Myers,et al.
Parameterized types for Java
,
1997,
POPL '97.