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.
- AG96 Ken Arnold and James Gosling. The Java Programming Language. Addison-Wesley, 1996. Google ScholarDigital Library
- BCC+96 Kim B. Bruce, Luca Oardelli, Giuseppe Gastagna, the Hopkins Objects Group, Gary T. Leavens, and Benjamln Pierce. On binary methods. Theory and Practice of'Object Systems, 1(3):221-242,1996. Google ScholarDigital Library
- Cas95 Giuseppe Castagna. Covariance and contravariance: Conflict without a cause. A OM Transactions on Programming Languages and Systems, 17(3):431--447, May 1995. Google ScholarDigital Library
- CCH+89 P. Canning, W. Cook, W. Hill, J. Mitchell, and W. Olthoff. F-bounded quantification for objectoriented programming. In Functional Prog. and Computer Architecture, pages 273-280, 1989. Google ScholarDigital Library
- DFW96 Drew Dean, Edward W. Felten, and Dan S. Wallach. Java security: from Hot Java to netscape and beyond. In Proceedings of the IEEE Computer Society Symposium on Research in Security and Privacy, pages 190-200, 1996. Google ScholarDigital Library
- ES90 M. Ellis and B. Stroustrup. The Annotated G++ Reference Manual. Addison-Wesley, 1990. Google ScholarDigital Library
- Jav96 JavaSoft. Innerclasses in Java 1.1. available from http:/{java.sun.com, 1996.Google Scholar
- KLM94 D. Katiyar, D. Luckham, and J.C. Mitchell. A type system for prototyping languages. In Proc. 21- st A CM Syrup. on Principles of Programming Languages, 1994. Google ScholarDigital Library
- L+81 B. Liskov et al. GLU Reference Manual. Springer LNCS 114, Berlin, 1981. Google ScholarDigital Library
- LBR96 Konstantin Lgufer, Gerald Baumgartner, and Vincent F. Russo. Safe structural conformance in java. Technical Report CSD-TR-96-077, Purdue University, December 1996.Google Scholar
- LSAS77 Barbara Liskov, Alan Snyder, Russell Atkinson, and Craig Schaffert. Abstraction mechanisms in CLU. Communications oj the A GM, 20(8):564-576, August 1977. Google ScholarDigital Library
- LY96 Tim Lindholm and Frank Yellin. The Java" Virtual Machine Specification. Addison-Wesley, 1996. ,' Google ScholarDigital Library
- MBL97 Andrew C. Myers, Joseph A. Bank, and Barbara Liskov. Parameterized types for Java. In Proe. 24th ACM SympOsium on Principles of Programming Lan. guages, pages 132-145, January 1997. Google Scholar
- Mil85 R. Milner. The Standard ML core language. Polymorphism, 2(2), 1985. 28 pages. An earlier version appeared in Proc. 1984 ACM Symp. on Lisp and Functional Programming.Google Scholar
- Mit96 J.O. Mitchell. Foundations }or Programming Languages. MIT Press, 1996. Google ScholarDigital Library
- MS95 D.R. Musser and A. Saini. STL Tutorial and Reference Guide. Addison-Wesley, 1995. Google ScholarDigital Library
- OW97a Martin Odersky and Philip Wadler. The Pizza compiler, available from http://www.math.luc.edu/pizza, February 1997.Google Scholar
- OW97b Martin Odersky and Philip Wadler. Pizza into Java: Translating theory into practice. In Proc. $4th AGM Symposium on Principles of Programming Languages, January 1997. Google ScholarDigital Library
- PSLM96 P. J. Plauger, A. A. Stepanov, M. Lee, and D. R. Musser. The Standard Template Library. Prentice- Hall, 1996. Google ScholarDigital Library
- Tho97 Kresten Krab Thorup. Genericity in Java with virtual types. In European Conference On Object Oriented Programming, 1997:Google Scholar
- Ull94 J.D. Ullman. Elements of ML programming. Prentice Hall, 1994. Google ScholarDigital Library
- US 80 US Dept. of Defense. Reference Manual }or the Ada Programming Language. GPO 008-000-00354-8, 19813.Google Scholar
Index Terms
- Adding type parameterization to the Java language
Recommendations
Adding type parameterization to the Java language
OOPSLA '97: Proceedings of the 12th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applicationsAlthough 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 ...
Adding wildcards to the Java programming language
SAC '04: Proceedings of the 2004 ACM symposium on Applied computingThis paper describes wildcards, a new language construct designed to increase the flexibility of object-oriented type systems with parameterized classes. Based on the notion of use-site variance, wildcards provide a type safe abstraction over different ...
Compile-time type-checking for custom type qualifiers in Java
OOPSLA '07: Companion to the 22nd ACM SIGPLAN conference on Object-oriented programming systems and applications companionWe have created a system that enables programmers to add custom type qualifiers to the Java language in a backward-compatible way. The system allows programmers to write type qualifiers in their programs and to create compiler plug-ins that enforce the ...
Comments