Typestates for Objects

Today’s mainstream object-oriented compilers and tools do not support declaring and statically checking simple pre- and postconditions on methods and invariants on object representations. The main technical problem preventing static verification is reasoning about the sharing relationships among objects as well as where object invariants should hold. We have developed a programming model of typestates for objects with a sound modular checking algorithm. The programming model handles typical aspects of object-oriented programs such as down-casting, virtual dispatch, direct calls, and subclassing. The model also permits subclasses to extend the interpretation of typestates and to introduce additional typestates. We handle aliasing by adapting our previous work on practical linear types developed in the context of the Vault system. We have implemented these ideas in a tool called Fugue for specifying and checking typestates on Microsoft .NET-based programs.

[1]  Robert DeLine,et al.  The fugue protocol checker: is your software baroque? technical report msr-tr-2004-07 , 2004 .

[2]  Viktor Kuncak,et al.  Existential Heap Abstraction Entailment Is Undecidable , 2003, SAS.

[3]  David Walker,et al.  Alias Types for Recursive Data Structures (Extended Version) , 2000 .

[4]  Jeannette M. Wing,et al.  A behavioral notion of subtyping , 1994, TOPL.

[5]  Didier Rémy,et al.  Objective ML: An Effective Object-Oriented Extension to ML , 1998, Theory Pract. Object Syst..

[6]  John Tang Boyland,et al.  Alias burying: Unique variables without destructive reads , 2001, Softw. Pract. Exp..

[7]  Mads Tofte,et al.  Implementation of the typed call-by-value λ-calculus using a stack of regions , 1994, POPL '94.

[8]  David Walker,et al.  Alias Types for Recursive Data Structures , 2000, Types in Compilation.

[9]  Stephen J. Garland,et al.  Larch: Languages and Tools for Formal Specification , 1993, Texts and Monographs in Computer Science.

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

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

[12]  K. Rustan M. Leino,et al.  Extended static checking , 1998, PROCOMET.

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

[14]  Robert DeLine,et al.  Adoption and focus: practical linear types for imperative programming , 2002, PLDI '02.

[15]  Greg Nelson,et al.  Extended static checking for Java , 2002, PLDI '02.

[16]  Robert E. Strom,et al.  Typestate: A programming language concept for enhancing software reliability , 1986, IEEE Transactions on Software Engineering.

[17]  Raymie Stata,et al.  Checking object invariants , 1997 .

[18]  Philip Wadler,et al.  Linear Types can Change the World! , 1990, Programming Concepts and Methods.

[19]  Viktor Kuncak,et al.  Role analysis , 2002, POPL '02.