ABSTRACT
Tracking the state of an object (in the sense of how a File can be in an Open or Closed state) is difficult not just because of the problem of managing state transitions but also due to the complexity introduced by aliasing. Unchecked duplication of object references makes local reasoning impossible by allowing situations where transitions can be triggered unexpectedly (for instance, passing aliased parameters to a method that expects unaliased parameters, or calling a method that has a side effect through an alias deeply nested in a data structure).
We propose a generalization of access permissions that goes beyond a fixed set of permissions to an object. In this paper we present a new aliasing control mechanism that uses a small set of permissions as building block for the creation of views that capture a projection of an object with specific access constraints to its fields and/or methods. This makes permission tracking more fine grained while also making the designer's intent more explicit.
We present a few meaningful examples of how these views handle situations such as: separating different sections of an object for safe initialization; and access with either an unbounded number of readers or a single writer (multiple readers or unique writer). Finally, we show a type system for checking correctness of state use in the presence of this kind of controlled aliasing.
- J. Aldrich, J. Sunshine, D. Saini, and Z. Sparks. Typestate-oriented programming. In Proc. Onward!, pages 1015--1022, 2009. Google ScholarDigital Library
- K. Bierhoff and J. Aldrich. Modular typestate checking of aliased objects. In Proc. Object-Oriented Programming Systems, Languages, and Applications, pages 301--320, 2007. Google ScholarDigital Library
- J. Boyland. Checking interference with fractional permissions. In Proc. Static Analysis Symposium, pages 55--72, 2003. Google ScholarDigital Library
- L. Caires. Spatial-behavioral types for concurrency and resource control in distributed systems. Theor. Comput. Sci., 402(2--3):120--141, 2008. Google ScholarDigital Library
- C. Calcagno, P. W. O'Hearn, and H. Yang. Local action and abstract separation logic. In Proc. Logic in Computer Science, pages 366--378, 2007. Google ScholarDigital Library
- F. Damiani, E. Giachino, P. Giannini, and S. Drossopoulou. A type safe state abstraction for coordination in java-like languages. Acta Inf., 45(7--8):479--536, 2008. Google ScholarDigital Library
- R. DeLine and M. Fähndrich. Typestates for objects. In European Conference on Object-Oriented Programming, pages 465--490. Springer, 2004.Google ScholarCross Ref
- S. J. Gay, V. T. Vasconcelos, A. Ravara, N. Gesbert, and A. Z. Caldeira. Modular session types for distributed object-oriented programming. In Proc. Principles of Programming Languages, pages 299--312, 2010. Google ScholarDigital Library
- A. Igarashi, B. C. Pierce, and P. Wadler. Featherweight Java: a minimal core calculus for Java and GJ. ACM Trans. Program. Lang. Syst., 23(3):396--450, 2001. Google ScholarDigital Library
- K. R. M. Leino. Data groups: specifying the modification of extended state. SIGPLAN Not., 33(10):144--153, 1998. Google ScholarDigital Library
- X. Qi and A. C. Myers. Masked types for sound object initialization. In Proc. Principles of Programming Languages, pages 53--65, 2009. Google ScholarDigital Library
- J. C. Reynolds. Separation logic: A logic for shared mutable data structures. In Proc. Logic in Computer Science, pages 55--74, 2002. Google ScholarDigital Library
- A. Sabry and M. Felleisen. Reasoning about programs in continuation-passing style. In Proc. LISP and Functional Programming, pages 288--298, 1992. Google ScholarDigital Library
- R. E. Strom and S. Yemini. Typestate: A programming language concept for enhancing software reliability. IEEE Trans. Software Eng., 12(1):157--171, 1986. Google ScholarDigital Library
- P. Wadler. Linear types can change the world! In Programming Concepts and Methods. North, 1990.Google Scholar
Index Terms
- Aliasing control with view-based typestate
Recommendations
Typestate-like analysis of multiple interacting objects
OOPSLA '08: Proceedings of the 23rd ACM SIGPLAN conference on Object-oriented programming systems languages and applicationsThis paper presents a static analysis of typestate-like temporal specifications of groups of interacting objects, which are expressed using tracematches. Whereas typestate expresses a temporal specification of one object, a tracematch state may change ...
Effective typestate verification in the presence of aliasing
ISSTA '06: Proceedings of the 2006 international symposium on Software testing and analysisThis paper addresses the challenge of sound typestate verification, with acceptable precision, for real-world Java programs. We present a novel framework for verification of typestate properties, including several new techniques to precisely treat ...
Comments