On Inner Classes

Inner classes in object-oriented languages play a role similar to nested function definitions in functional languages, allowing an object to export other objects that have 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 Specification. We prove that the two semantics coincide, in the sense that translation commutes with reduction, and that both are type-safe.

[1]  David Robson,et al.  Smalltalk-80: The Language and Its Implementation , 1983 .

[2]  O. J. Dahl,et al.  Simula Begin , 1979 .

[3]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

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

[5]  Ole Lehrmann Madsen,et al.  Semantic analysis of virtual classes and nested classes , 1999, OOPSLA '99.

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

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

[8]  Martin Odersky,et al.  A Statically Safe Alternative to Virtual Types , 1998, ECOOP.

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

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

[11]  Philip Wadler,et al.  Featherweight Java: a minimal core calculus for Java and GJ , 2001, TOPL.

[12]  Ole Lehrmann Madsen,et al.  Object-oriented programming in the BETA programming language , 1993 .

[13]  Ole Lehrmann Madsen,et al.  Virtual classes: a powerful mechanism in object-oriented programming , 1989, OOPSLA '89.

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

[15]  Bjarne Stroustrup,et al.  C++ Programming Language , 1986, IEEE Softw..

[16]  Martín Abadi,et al.  Protection in Programming-Language Translations , 1998, ICALP.

[17]  G.D. Plotkin,et al.  LCF Considered as a Programming Language , 1977, Theor. Comput. Sci..

[18]  Neal Glew Object Closure Conversion , 1999, Electron. Notes Theor. Comput. Sci..