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 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 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 minimal syntax, typing rules, and operational semantics of Featherweight Java make it a handy tool for studying 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 give a detailed proof of type safety. The extended system formalizes for the first time some of the key features of GJ.

[1]  Harold T. Hodes,et al.  The | lambda-Calculus. , 1988 .

[2]  Luca Cardelli,et al.  An Extension of System F with Subtyping , 1991, TACS.

[3]  Kim B. Bruce A paradigmatic object-oriented programming language: Design, static typing and semantics , 1994, Journal of Functional Programming.

[4]  Benjamin C. Pierce,et al.  Simple type-theoretic foundations for object-oriented programming , 1994, Journal of Functional Programming.

[5]  Matthias Felleisen,et al.  A Syntactic Approach to Type Soundness , 1994, Inf. Comput..

[6]  Mitchell Wand Type inference for objects with instance variables and inheritance , 1994 .

[7]  Martín Abadi,et al.  A Theory of Objects , 1996, Monographs in Computer Science.

[8]  Matthias Felleisen,et al.  A little Java, a few patterns , 1997 .

[9]  Martin Odersky,et al.  Pizza into Java: translating theory into practice , 1997, POPL '97.

[10]  Stephen N. Freund,et al.  Adding type parameterization to the Java language , 1997, OOPSLA '97.

[11]  Andrew C. Myers,et al.  Parameterized types for Java , 1997, POPL '97.

[12]  Tobias Nipkow,et al.  Javalight is type-safe—definitely , 1998, POPL '98.

[13]  Viviana Bono,et al.  An Imperative, First-Order Calculus with Object Extension , 1998, ECOOP.

[14]  Martin Odersky,et al.  Making the future safe for the past: adding genericity to the Java programming language , 1998, OOPSLA '98.

[15]  David von Oheimb,et al.  Javàight Is Type-safe | Deenitely , 1998 .

[16]  Matthias Felleisen,et al.  Classes and mixins , 1998, POPL '98.

[17]  John C. Mitchell,et al.  On the Relationship Between Classes, Objects, and Data Abstraction , 1998, Theory Pract. Object Syst..

[18]  Robert Cartwright,et al.  Compatible genericity with run-time types for the Java programming language , 1998, OOPSLA '98.

[19]  Vitaly Shmatikov,et al.  A Core Calculus of Classes and Mixins , 1999, ECOOP.

[20]  Don Syme,et al.  Proving Java Type Soundness , 1999, Formal Syntax and Semantics of Java.

[21]  Vitaly Shmatikov,et al.  A Core Calculus of Classes and Objects , 1999, MFPS.

[22]  Matthias Felleisen,et al.  A Programmer's Reduction Semantics for Classes and Mixins , 1999, Formal Syntax and Semantics of Java.

[23]  Sarfraz Khurshid,et al.  Is the Java Type System Sound? , 1999, Theory Pract. Object Syst..

[24]  Dominic Duggan Modular type-based reverse engineering of parameterized types in Java code , 1999, OOPSLA '99.

[25]  Mirko Viroli,et al.  Parametric polymorphism in Java: an approach to translation based on reflective features , 2000, OOPSLA '00.

[26]  Atsushi Igarashi,et al.  On Inner Classes , 2000, ECOOP.

[27]  Ulrik Pagh Schultz,et al.  Partial Evaluation for Class-Based Object-Oriented Languages , 2000, PADO.

[28]  Thomas Studer,et al.  Constructive Foundations for Featherweight Java , 2001, Proof Theory in Computer Science.

[29]  Philip Wadler,et al.  A Recipe for Raw Types , 2001 .

[30]  Davide Ancona,et al.  True Modules for Java-like Languages , 2001, ECOOP.

[31]  Zhong Shao,et al.  Type-preserving compilation of Featherweight Java , 2002, TOPL.

[32]  Benjamin C. Pierce,et al.  Types and programming languages: the next generation , 2003, 18th Annual IEEE Symposium of Logic in Computer Science, 2003. Proceedings..