Type-Based Object Immutability with Flexible Initialization

We present a type system for checking object immutability, read-only references, and class immutability in an open or closed world. To allow object initialization outside object constructors (which is often needed in practice), immutable objects are initialized in lexically scoped regions. The system is simple and direct; its only type qualifiers specify immutability properties. No auxiliary annotations, e.g., ownership types, are needed, yet good support for deep immutability is provided. To express object confinement, as required for class immutability in an open world, we use qualifier polymorphism. The system has two versions: one with explicit specification commands that delimit the object initialization phase, and one where such commands are implicit and inferred. In the latter version, all annotations are compatible with Java's extended annotation syntax, as proposed in JSR 308.

[1]  James Cheney,et al.  Region-based memory management in cyclone , 2002, PLDI '02.

[2]  Erik Poll,et al.  Type-based Object Immutability with Flexible Initialization - extended version , 2009 .

[3]  Robert DeLine,et al.  Enforcing high-level protocols in low-level software , 2001, PLDI '01.

[4]  K. Rustan M. Leino,et al.  Declaring and checking non-null types in an object-oriented language , 2003, OOPSLA 2003.

[5]  Gilad Bracha Pluggable Type Systems , 2004 .

[6]  Tobias Wrigstad,et al.  Ownership-Based Alias Managemant , 2006 .

[7]  Dave Clarke,et al.  Ownership, Uniqueness, and Immutability , 2008, TOOLS.

[8]  David Walker,et al.  Alias Types , 2000, ESOP.

[9]  John Tang Boyland,et al.  Connecting effects and uniqueness with adoption , 2005, POPL '05.

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

[11]  John Tang Boyland,et al.  Checking Interference with Fractional Permissions , 2003, SAS.

[12]  Erik Poll,et al.  Immutable Objects for a Java-Like Language , 2007, ESOP.

[13]  Dave Clarke,et al.  External Uniqueness Is Unique Enough , 2003, ECOOP.

[14]  Michael D. Ernst,et al.  Practical pluggable types for java , 2008, ISSTA '08.

[15]  Vivek Sarkar,et al.  Immutability specification and its applications , 2005, Concurr. Pract. Exp..

[16]  James Noble,et al.  Generic ownership for generic Java , 2006, OOPSLA '06.

[17]  Monica S. Lam,et al.  Automatic inference of stationary fields: a generalization of java's final fields , 2008, POPL '08.

[18]  Michael D. Ernst,et al.  Object and reference immutability using Java generics , 2007, ESEC-FSE '07.

[19]  K. Rustan M. Leino,et al.  Declaring and checking non-null types in an object-oriented language , 2003, OOPSLA.

[20]  Jonathan Aldrich,et al.  Modular Typestate Verification of Aliased Objects , 2007 .

[21]  Jonathan Aldrich,et al.  Modular typestate checking of aliased objects , 2007, OOPSLA.

[22]  Martin Rinard,et al.  Safejava: a unified type system for safe programming , 2004 .

[23]  Brian Campbell,et al.  Amortised Memory Analysis Using the Depth of Data Structures , 2009, ESOP.

[24]  Xin Qi,et al.  Masked types for sound object initialization , 2009, POPL '09.

[25]  Erik Ernst,et al.  ECOOP 2007 - Object-Oriented Programming, 21st European Conference, Berlin, Germany, July 30 - August 3, 2007, Proceedings , 2007, ECOOP.

[26]  Jørgen Lindskov Knudsen ECOOP 2001 — Object-Oriented Programming , 2001, Lecture Notes in Computer Science.

[27]  Luca Cardelli,et al.  ECOOP 2003 – Object-Oriented Programming , 2003, Lecture Notes in Computer Science.

[28]  Jan Vitek,et al.  Confined types in Java , 2001, Softw. Pract. Exp..

[29]  David Walker,et al.  Typed memory management in a calculus of capabilities , 1999, POPL '99.

[30]  James Noble,et al.  Ownership types for flexible alias protection , 1998, OOPSLA '98.

[31]  Songtao Xia,et al.  Establishing object invariants with delayed types , 2007, OOPSLA.

[32]  John Tang Boyland,et al.  Capabilities for Sharing: A Generalisation of Uniqueness and Read-Only , 2001, ECOOP.

[33]  Mads Tofte,et al.  Region-based Memory Management , 1997, Inf. Comput..

[34]  James Noble,et al.  Featherweight generic confinement , 2006, Journal of Functional Programming.

[35]  Vivek Sarkar,et al.  Immutability specification and its applications: Research Articles , 2005 .

[36]  Bilha Mendelson,et al.  Automatic detection of immutable fields in Java , 2000, CASCON.

[37]  K. Rustan M. Leino,et al.  Flexible Immutability with Frozen Objects , 2008, VSTTE.

[38]  John Hunt A Little Java , 1998 .

[39]  Sophia Drossopoulou,et al.  Generic Universe Types , 2007, ECOOP.

[40]  K. Rustan M. Leino,et al.  Verification of Object-Oriented Programs with Invariants , 2003, J. Object Technol..