Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
article
Open access

Featherweight Java: a minimal core calculus for Java and GJ

Published: 01 May 2001 Publication History
  • Get Citation Alerts
  • 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 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.

    References

    [1]
    ABADI,M.AND CARDELLI, L. 1996. A Theory of Objects. Springer Verlag, New York, NY.]]
    [2]
    AGESEN, O., FREUND,S.N.,AND MITCHELL, J. C. 1997. Adding type parameterization to the Java language. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'97). SIGPLAN Not. 32, 10. ACM Press, Atlanta, GA, 49-65.]]
    [3]
    ANCONA,D.AND ZUCCA, E. 2001. True modules for Java-like languages. In Proceedings of the 15th European Conference on Object-Oriented Programming (ECOOP2001), J. L. Knudsen, Ed. Lecture Notes in Computer Science. Springer-Verlag, Budapest, Hungary.]]
    [4]
    BARENDREGT, H. P. 1984. The Lambda Calculus, revised ed. North Holland, Amsterdam, The Netherlands.]]
    [5]
    BONO,V.AND FISHER, K. 1998. An imperative first-order calculus with object extension. In Proceedings of the 12th European Conference on Object-Oriented Programming (ECOOP'98), E. Jul, Ed. LNCS 1445. Springer Verlag, 462-497.]]
    [6]
    BONO, V., PATEL,A.J.,AND SHMATIKOV, V. 1999a. A core calculus of classes and mixins. In Proceedings of the 13th European Conference on Object-Oriented Programming (ECOOP'99). LNCS 1628. Springer Verlag, 43-66.]]
    [7]
    BONO, V., PATEL,A.J.,SHMATIKOV,V.,AND MITCHELL, J. C. 1999b. A core calculus of classes and objects. In Proceedings of the 15th Conference on the Mathematical Foundations of Programming Semantics (MFPS XV). Elsevier. Available through http://www.elsevier.nl/locate/entcs/ volume20.html.]]
    [8]
    BRACHA, G., ODERSKY, M., STOUTAMIRE,D.,AND WADLER, P. 1998. Making the future safe for the past: Adding genericity to the Java programming language. In Proceedings of the ACMSIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'98), C. Chambers, Ed. ACM Press, New York, NY, 183-200.]]
    [9]
    BRUCE, K. B. 1994. A paradigmatic object-oriented programming language: Design, static typing and semantics. J. Funct. Program. 4, 2 (April), 127-206.]]
    [10]
    CARDELLI, L., MARTINI, S., MITCHELL,J.C.,AND SCEDROV, A. 1994. An extension of system F with subtyping. Inf. Comput. 109, 1-2, 4-56.]]
    [11]
    CARTWRIGHT,R.AND STEELE JR., G. L. 1998. Compatible genericity with run-time types for the Java programming language. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'98), C. Chambers, Ed. ACM Press, New York, NY, 201-215.]]
    [12]
    DROSSOPOULOU, S., EISENBACH,S.,AND KHURSHID, S. 1999. Is the Java type system sound? Theory Pract. Object Syst. 7, 1, 3-24.]]
    [13]
    DUGGAN, D. 1999. Modular type-based reverse engineering of parameterized types in Java code. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'99), L. M. Northrop, Ed. ACM Press, New York, NY, 97-113.]]
    [14]
    FELLEISEN,M.AND FRIEDMAN, D. P. 1998. A Little Java, A Few Patterns. MIT Press, Cambridge, MA.]]
    [15]
    FISHER,K.AND MITCHELL, J. C. 1998. On the relationship between classes, objects, and data abstraction. Theory Pract. Object Syst. 4, 1, 3-25.]]
    [16]
    FLATT, M., KRISHNAMURTHI,S.,AND FELLEISEN, M. 1998a . Classes and mixins. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM Press, New York, NY, 171-183.]]
    [17]
    FLATT, M., KRISHNAMURTHI,S.,AND FELLEISEN, M. 1998b. A programmer's reduction semantics for classes and mixins. Tech. Rep. TR97-293, Computer Science Dept., Rice University. Feb. Corrected version in June, 1999.]]
    [18]
    IGARASHI,A.AND PIERCE, B. C. 2000. On inner classes. In Proceedings of the 14th European Conference on Object-Oriented Programming (ECOOP2000), E. Bertino, Ed. LNCS 1850. Springer Verlag, 129-153. Extended version to appear in Inf. Comput.]]
    [19]
    IGARASHI, A., PIERCE,B.C.,AND WADLER, P. 2001. A recipe for raw types. In Informal Proceedings of the 8th International Workshop on Foundations of Object-Oriented Languages (FOOL8). London, UK. Available through http://www.cs.williams.edu/kim/FOOL/FOOL8.html.]]
    [20]
    LEAGUE, C., TRIFONOV,V.,AND SHAO, Z. 2001. Type-preserving compilation of Featherweight Java. In Informal Proceedings of the 8th International Workshop on Foundations of Object-Oriented Languages (FOOL8). London, UK. Available through http://www.cs.williams.edu/kim/FOOL/ FOOL8.html.]]
    [21]
    MYERS,A.C.,BANK,J.A.,AND LISKOV, B. 1997. Parameterized types for Java. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM Press, New York, NY, 132-145.]]
    [22]
    NIPKOW,T.AND VON OHEIMB, D. 1998. Java light is type-safe- definitely. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM Press, New York, NY, 161-170.]]
    [23]
    ODERSKY,M.AND WADLER, P. 1997. Pizza into Java: Translating theory into practice. In Proceedings of the ACMSIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM Press, New York, NY, 146-159.]]
    [24]
    PIERCE, B. C. 2002. Types and Programming Languages. MIT Press, Cambridge, MA.]]
    [25]
    PIERCE,B.C.AND TURNER, D. N. 1994. Simple type-theoretic foundations for object-oriented programming. J. Funct. Program. 4, 2 (April), 207-247.]]
    [26]
    SCHULTZ, U. 2001. Partial evaluation for class-based object-oriented languages. In Proceedings of the 2nd Symposium on Programs as Data Objects (PADO II), O. Danvy and A. Filinski, Eds. LNCS 2053. Springer Verlag, 173-197.]]
    [27]
    STUDER, T. 2000. Constructive foundations for Featherweight Java. Available through http:// iamwww.unibe.ch/tstuder/.]]
    [28]
    SYME, D. 1997. Proving Java type soundness. Tech. Rep. 427, Computer Lab. Univ. of Cambridge. June.]]
    [29]
    VIROLI,M.AND NATALI, A. 2000. Parametric polymorphism in Java: an approach to translation based on reflective features. In Proceedings of the ACMSIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'00), D. Lea, Ed. ACM Press, New York, NY, 146-165.]]
    [30]
    WAND, M. 1989. Type inference for objects with instance variables and inheritance. Tech. Rep. NU-CCS-89-2, College of Computer Science, Northeastern Univ. Feb.]]
    [31]
    WRIGHT,A.K.AND FELLEISEN, M. 1994. A syntactic approach to type soundness. Inf. Comput. 115, 1 (Nov.), 38-94.]]

    Cited By

    View all
    • (2024)Teaching Type Systems Implementation with Stella, an Extensible Statically Typed Programming LanguageElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.405.1405(1-19)Online publication date: 10-Jul-2024
    • (2024)Generating Well-Typed Terms That Are Not “Useless”Proceedings of the ACM on Programming Languages10.1145/36329198:POPL(2318-2339)Online publication date: 5-Jan-2024
    • (2024)The eXchange Calculus (XC)Journal of Systems and Software10.1016/j.jss.2024.111976210:COnline publication date: 1-Apr-2024
    • Show More Cited By

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Transactions on Programming Languages and Systems
    ACM Transactions on Programming Languages and Systems  Volume 23, Issue 3
    May 2001
    178 pages
    ISSN:0164-0925
    EISSN:1558-4593
    DOI:10.1145/503502
    Issue’s Table of Contents

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 01 May 2001
    Published in TOPLAS Volume 23, Issue 3

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. Compilation
    2. Java
    3. generic classes
    4. language design
    5. language semantics

    Qualifiers

    • Article

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)333
    • Downloads (Last 6 weeks)39
    Reflects downloads up to 27 Jul 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)Teaching Type Systems Implementation with Stella, an Extensible Statically Typed Programming LanguageElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.405.1405(1-19)Online publication date: 10-Jul-2024
    • (2024)Generating Well-Typed Terms That Are Not “Useless”Proceedings of the ACM on Programming Languages10.1145/36329198:POPL(2318-2339)Online publication date: 5-Jan-2024
    • (2024)The eXchange Calculus (XC)Journal of Systems and Software10.1016/j.jss.2024.111976210:COnline publication date: 1-Apr-2024
    • (2024)Programming Language Implementations with Multiparty Session TypesActive Object Languages: Current Research Trends10.1007/978-3-031-51060-1_6(147-165)Online publication date: 29-Jan-2024
    • (2023)A Monadic Framework for Name Resolution in Multi-phased Type CheckersProceedings of the 22nd ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences10.1145/3624007.3624051(14-28)Online publication date: 22-Oct-2023
    • (2023)Inference of Resource Management SpecificationsProceedings of the ACM on Programming Languages10.1145/36228587:OOPSLA2(1705-1728)Online publication date: 16-Oct-2023
    • (2023)Simple Reference Immutability for System F<:Proceedings of the ACM on Programming Languages10.1145/36228287:OOPSLA2(857-881)Online publication date: 16-Oct-2023
    • (2023)Mutually Iso-Recursive SubtypingProceedings of the ACM on Programming Languages10.1145/36228097:OOPSLA2(347-373)Online publication date: 16-Oct-2023
    • (2023)How to Evaluate Blame for Gradual Types, Part 2Proceedings of the ACM on Programming Languages10.1145/36078367:ICFP(159-186)Online publication date: 31-Aug-2023
    • (2023)Gradual Guarantee for FJ with lambda-ExpressionsProceedings of the 25th ACM International Workshop on Formal Techniques for Java-like Programs10.1145/3605156.3606453(32-38)Online publication date: 18-Jul-2023
    • Show More Cited By

    View Options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Get Access

    Login options

    Full Access

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media