Abstract
Inner classes in object-oriented languages play a role similar to nested function definitions in functional languages, allowing an object to export other objects with direct access to its own methods and instance variables. However, the similarity is deceptive: a close look at inner classes reveals significant subtleties arising from their interactions with inheritance.
The goal of this work is a precise understanding of the essential features of inner classes; our object of study is a fragment of Java with inner classes and inheritance (and almost nothing else). We begin by giving a direct reduction semantics for this language. We then give an alternative semantics by translation into a yet smaller language with only top-level classes, closely following Java’s Inner Classes Specfication. We prove that the two semantics coincide, in the sense that translation commutes with reduction, and that both are type-safe.
This work was done while the author was visiting University of Pennsylvania.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Martín Abadi. Protection in programming-language translations. In Proceedings of the 25th International Colloquium on Automata, Languages and Programming (ICALP’98), pages 868–883. Springer-Verlag, July 1998. also appeared as DEC SRC Research Report 154 (April 1998).
Anasua Bhowmik and William Pugh. A secure implementation of Java inner classes. Handout from PLDI’ 99 Poster Session. Available through http://www.cs.umd.edu/~pugh/java.
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 Programming: Systems, Languages, and Applications (OOPSLA), ACM SIGPLAN Notices volume 33 number 10, pages 183–200, Vancouver, BC, October 1998.
Patrick Chan and Rosanna Lee. The Java Class Libraries, volume 2. Addison-Wesley, Reading, MA, second edition, October 1997.
S. Drossopoulou, S. Eisenbach, and S. Khurshid. Is the Java Type System Sound? Theory and Practice of Object Systems, 7(1):3–24, 1999. Preliminary version in ECOOP’ 97.
Matthew Flatt, Shriram Krishnamurthi, and Matthias Felleisen. Classes and mixins. In ACM Symposium on Principles of Programming Languages (POPL), San Diego, January 1998. ACM.
Neal Glew. Object closure conversion. In Andrew Gordon and Andrew Pitts, editors, Proceedings of the 3rd International Workshop on Higher Order Operational Techniques in Semantics (HOOTS’99), volume 26 of Electronic Notes in Theoretical Computer Science, Paris, France, September 1999. Elsevier. Available through http://www.elsevier.nl/locate/entcs/volume26.html.
Adele Goldberg and David Robson. Smalltalk-80: The Language and Its Implementation. Addison-Wesley, Reading, MA, 1983.
James Gosling, Bill Joy, and Guy Steele. The Java Language Specification. Addison Wesley, 1996.
Atsushi Igarashi, Benjamin Pierce, and Philip Wadler. Featherweight Java: A minimal core calculus for Java and GJ. In Linda M. Northrop, editor, Object Oriented Programming: Systems, Languages, and Applications (OOPSLA), ACM SIGPLAN Notices, volume 34, number 10, pages 132–146. ACM Press, October 1999.
Atsushi Igarashi and Benjamin C. Pierce. On inner classes. Technical Report MSCIS-99-23, University of Pennsylvania, Philadelphia, PA, November 1999. Available through http://web.yl.is.s.u-tokyo.ac.jp/~igarashi/papers.html.
JavaSoft. Inner classes specification, February 1997. Available through http://java.sun.com/products/JDK/1.1/.
Ole Lehrmann Madsen. Semantic analysis of virtual classes and nested classes. In Linda M. Northrop, editor, Object Oriented Programming: Systems, Languages, and Applications (OOPSLA), ACM SIGPLAN Notices, volume 34, number 10, pages 114–131, Denver, CO, October 1999. ACM Press.
Ole Lehrmann Madsen and Birger Møller-Pedersen. Virtual classes: A powerful mechanism in object-oriented programming. In Object Oriented Programming: Systems, Languages, and Applications (OOPSLA), 1989.
Ole Lehrmann Madsen, Birger Møller-Pedersen, and Kristen Nygaard. Object-Oriented Programming in the Beta Programming Language. Addison-Wesley, 1993.
Microsoft. Microsoft Java SDK 3.2 documentation. Available online through http://www.microsoft.com/Java/sdk/32/,1999.
Tobias Nipkow and David von Oheimb. Javalight is type-safe-definitely. In ACM Symposium on Principles of Programming Languages (POPL), pages 161–170, San Diego, January 1998. ACM.
G. D. Plotkin. LCF considered as a programming language. Theoretical Computer Science, 5:223–255, 1977.
Don Syme. Proving Java type soundness. Technical Report 427, Computer Laboratory, University of Cambridge, June 1997.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2000 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Igarashi, A., Pierce, B.C. (2000). On Inner Classes. In: Bertino, E. (eds) ECOOP 2000 — Object-Oriented Programming. ECOOP 2000. Lecture Notes in Computer Science, vol 1850. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45102-1_7
Download citation
DOI: https://doi.org/10.1007/3-540-45102-1_7
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-67660-7
Online ISBN: 978-3-540-45102-0
eBook Packages: Springer Book Archive