Adding type parameterization to the Java language

  • Authors:
  • Ole Agesen;Stephen N. Freund;John C. Mitchell

  • Affiliations:
  • Sun Microsystems Laboratories, 2 Elizabeth Drive, Chelmsford, MA;Department of Computer Science, Stanford University, Stanford, CA;Department of Computer Science, Stanford University, Stanford, CA

  • Venue:
  • Proceedings of the 12th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications
  • Year:
  • 1997

Quantified Score

Hi-index 0.00

Visualization

Abstract

Although the Java programming language has achieved widespread acceptance, one feature that seems sorely missed is the ability to use type parameters (as in Ada generics, C++ templates, and ML polymorphic functions or data types) to allow a general concept to be instantiated to one or more specific types. In this paper, we propose parameterized classes and interfaces in which the type parameter may be constrained to either implement a given interface or extend a given class. This design allows the body of a parameterized class to refer to methods on objects of the parameter type, without introducing any new type relations into the language. We show that these Java extensions may be implemented by expanding parameterized classes at class load time, without any extension or modification to existing Java bytecode, verifier or bytecode interpreter.