ABSTRACT
Several recent studies have introduced lightweight versions of Java: reduced languages in which complex features like threads and reflection are dropped to enable rigorous arguments about key properties such as type safety. We carry this process a step further, omitting almost all features of the full language (including interfaces and even assignment) to obtain a small calculus, Featherweight Java, for which rigorous proofs are not only possible but easy.
Featherweight Java bears a similar relation to full Java as the lambda-calculus does to languages such as ML and Haskell. It offers a similar computational “feel,” providing classes, methods, fields, inheritance, and dynamic typecasts, with a semantics closely following Java's. A proof of type safety for Featherweight Java thus illustrates many of the interesting features of a safety proof for the full language, while remaining pleasingly compact. The syntax, type rules, and operational semantics of Featherweight Java fit on one page, making it easier to understand the consequences of extensions and variations.
As an illustration of its utility in this regard, we extend Featherweight Java with generic classes in the style of GJ (Bracha, Odersky, Stoutamire, and Wadler) and sketch a proof of type safety. The extended system formalizes for the first time some of the key features of GJ.
- 1.Martin Abadi and Luca Cardelli. A Theory of Objects. Springer-Verlag, 1996.]] Google ScholarDigital Library
- 2.Ole Agesen, Stephen N. Freund, and John C. Mitchell. Adding type parameterization to the Java language. 'In Object Oriented Programing: Systems, Languages, and Applications (OOPSLA), October 1997.]] Google ScholarDigital Library
- 3.H. P. Barendregt. The Lambda Calculus. North Holland, revised edition, 1984.]]Google Scholar
- 4.Viviana Bono and Kathleen Fisher. An imperative first-order calculus with object extension. In Proceedings of the European Conference on Object- Oriented Programming (ECOOP), 1998.]] Google ScholarDigital Library
- 5.Viviana Bono, Amit J. Patel, and Vitaly Shmatikov. A core calculus of classes and mixins. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP), volume 1628 of Lecture Notes in Computer Science, pages 43-66. Springer-Verlag, June 1999.]] Google ScholarDigital Library
- 6.Viviana Bono, Amit J. Patel, Vitaly Shmatikov, and John C. Mitchell. A core calculus of classes and objects. In Fifteenth Confertence on the Mathematical Foundations of Programming Semantics, April 1999.]]Google ScholarCross Ref
- 7.Gilad Bracha, Martin Odersky, David Stoutamire, and Philip Wadler. Making the future safe for the past- Adding genericity to the Java programming language. In Craig Chambers, editor, Object Oriented Programing: Systems, Languages, and Applications (0OPSLA}, ACM SIGPLAN Notices volume 33 number 10, pages 183-200, Vancouver, BC, October 1998.]] Google ScholarDigital Library
- 8.Kim B. Bruce. A paradigmatic object-oriented programming language' Design, static typing and semantics. Journal of Functional Programming, 4(2), April 1994. Preliminary version in POPL 1993, under the title "Safe type checking in a statically typed object-oriented programming language".]]Google ScholarCross Ref
- 9.Luca Cardelli, Simone Martini, John C. Mitchell, and Andre Scedrov. An extension of system F with subtyping. Information and Computation, 109(1- 2):4-56, 1994. Preliminary version in TACS '91 (Sendal, Japan, pp. 750-770).]] Google ScholarDigital Library
- 10.Robert Cartwright and Guy L. Steele Jr. Compatible genericity with run-time types for the Java programming language. In Craig Chambers, editor, Object Oriented Programing: Systems, Languages, and Applications (OOPSLA), SIGPLAN Notices 33(10), pages 201-215, Vancouver, BC, Octover 1998. ACM.]] Google ScholarDigital Library
- 11.S. Drossopoulou, S. Eisenbach, and S. Xhu.rshid. Is the Java Type System Sound? Theory and Practice of Object Systems~ 7(1):3-24, 1999. Preliminary version in ECOOP '97.]] Google ScholarDigital Library
- 12.Matthias Felleisen and Daniel P. Friedman. A little Java, A few Patterns. The MIT Press, Cambridge, Massachusetts, 1998.]] Google ScholarDigital Library
- 13.Kathleen Fisher and John C. Mitchell. On the relationship between classes, objects, and data abstraction. Theory and Practice of Object Systems, 4(1):3-25, 1998.]] Google ScholarDigital Library
- 14.Matthew Flatt, Shriram Krishnamurthi, and Matthias FeUeisen. Classes and mixins, in A CM Symposium on Principles of Programming Languages (POPL), San Diego, January 1998. ACM.]] Google ScholarDigital Library
- 15.Matthew Flatt, Shriram Krishnamurthi, and Matthias Felleisen. A programmer's reduction semantics for classes and mixins. Technical Report TR97-293, Computer Science Department, Rice University, February 1998. Corrected version appeared in June, 1999.]]Google Scholar
- 16.Atsushi Igarashi and Benjamin C. Pierce. On inner classes, july 1999. Submitted for publication.]]Google Scholar
- 17.Andrew C. Myers, Joseph A. Bank, and Barbara Liskov. Parameterized types for Java. In A CM Symposium on Principles of Programming Languages (POPL), January 1997.]] Google ScholarDigital Library
- 18.Tobias Nipkow and David yon Oheimb. Javatig^t is type-safe -- definitely. In A CM Symposium on Principles of Programmin9 Languages (POPL), pages 161-170, San Diego, January 1998. ACM.]] Google ScholarDigital Library
- 19.Martin Odersky and Philip Wadler. Pizza into Java: Translating theory into practice. In A CM Symposium on Principles of Programming Languages (POPL), 1997.]] Google ScholarDigital Library
- 20.Benjamin C. Pierce and David N. Turner. Simple type-theoretic foundations for object-oriented programming. Journal of Functional Programming, 4(2):207-247, April 1994. Preliminary version in Principles of Programming Languages (POPL), 1993.]]Google ScholarCross Ref
- 21.Don Syme. Proving Java type soundness. Technical Report 427, Computer Laboratory, University of Cambridge, June 1997.]]Google Scholar
- 22.Mitchell Wand. Type inference for objects with instance variables and inheritance. Technical Report NU-CCS-89-2, College of Computer Science, Northeastern University, February 1989. Also in Carl A. Gunter and John (2. Mitchell, editors, Theoretical Aspects of Object-Oriented Programming: Types, Semantics, and Language Design (MIT Press, 1994).]] Google ScholarDigital Library
Index Terms
- Featherweight Java: a minimal core calculus for Java and GJ
Recommendations
Featherweight Java: a minimal core calculus for Java and GJ
Several recent studies have introduced lightweight versions of Java: reduced languages in which complex features like threads and reflection are dropped to enable rigorous arguments about key properties such as type safety. We carry this process a step ...
Featherweight Java: a minimal core calculus for Java and GJ
Several recent studies have introduced lightweight versions of Java: reduced languages in which complex features like threads and reflection are dropped to enable rigorous arguments about key properties such as type safety. We carry this process a step ...
Typeless programming in Java 5.0
PPPJ '06: Proceedings of the 4th international symposium on Principles and practice of programming in JavaWith the introduction of Java 5.0 [9] the type system has been extended by parameterized types, type variables, type terms, and wildcards. As a result very complex types can arise. The termVector<Vector<AbstractList<Integer>>>is for example a correct ...
Comments