Abstract
Modular analyses of object-oriented programs need clear encapsulation boundaries between program components. The reference semantics of object-oriented languages complicates encapsulation. Ownership type systems are a way to guarantee encapsulation. However, they introduce a substantial and nontrivial annotation overhead for the programmer. This is in particular true for type systems with an access policy that is more flexible than owners-as-dominators. As we want to use ownership disciplines as basis for modular analyses, we need the flexibility. However, to keep it practical, the annotation overhead should be kept minimal.
In this paper, we present such a flexible ownership type system together with an inference technique to reduce the annotation overhead. Runtime components in our approach can be accessed via the interface of the owner as well as via other boundary objects with explicitly declared interface types. The resulting type system is quite complex, however, the programmer only has to annotate the interface types of a component. The ownership type information for the classes implementing the components is automatically inferred by a constraint-based algorithm. We proved the soundness of our approach for a Java-like core language.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Agarwal, R., Stoller, S.D.: Type inference for parameterized race-free Java. In: Steffen, B., Levi, G. (eds.) VMCAI 2004. LNCS, vol. 2937, pp. 149–160. Springer, Heidelberg (2004)
Aldrich, J., Chambers, C.: Ownership domains: Separating aliasing policy from mechanism. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, pp. 1–25. Springer, Heidelberg (2004)
Aldrich, J., Kostadinov, V., Chambers, C.: Alias annotations for program understanding. In: Proc. OOPSLA 2002, Seattle, Washington, USA, Nov. 2002, pp. 311–330. ACM Press, New York (2002)
Almeida, P.S.: Balloon Types: Controlling sharing of state in data types. In: Aksit, M., Matsuoka, S. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 32–59. Springer, Heidelberg (1997)
Boyapati, C.: SafeJava: A Unified Type System for Safe Programming. PhD thesis, Massachusetts Institute of Technology (February 2004)
Boyapati, C., Rinard, M.: A parameterized type system for race-free java programs. In: Proc. OOPSLA 2001, Tampa, Florida, USA, Oct. 2001, pp. 56–69. ACM Press, New York (2001)
Boyapati, C., Lee, R., Rinard, M.: Ownership types for safe programming: Preventing data races and deadlocks. In: Proc. OOPSLA 2002, Seattle, Washington, USA, Nov. 2002, pp. 211–230. ACM Press, New York (2002)
Boyapati, C., Liskov, B., Shrira, L.: Ownership types for object encapsulation. In: Proc. POPL ’03, January 2003, pp. 213–223. ACM Press, New York (2003)
Clarke, D.: Object Ownership and Containment. PhD thesis, University of New South Wales (July 2001)
Clarke, D., Drossopoulou, S.: Ownership, encapsulation, and the disjointness of type and effect. In: Proc. OOPSLA 2002, Seattle, Washington, USA, Nov. 2002, pp. 292–310. ACM Press, New York (2002)
Clarke, D., Potter, J., Noble, J.: Ownership types for flexible alias protection. In: Proc. OOPSLA ’98, October 1998, pp. 48–64. ACM Press, New York (1998)
Clarke, D., Noble, J., Potter, J.M.: Simple ownership types for object containment. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 53–76. Springer, Heidelberg (2001)
Detlefs, D.L., et al.: Wrestling with rep exposure. Research Report 156, Digital Systems Research Center, SRC-RR-156 (July 1998)
Dietl, W., Müller, P.: Universes: Lightweight ownership for JML. Journal of Object Technology 4(8), 5–32 (2005)
Donovan, A., et al.: Converting java programs to use generic libraries. In: OOPSLA ’04, Vancouver, Canada, pp. 15–34. ACM Press, New York (2004)
Flanagan, C., Freund, S.N., Lifshin, M.: Type inference for atomicity. In: Proc. TLDI ’05, pp. 47–58. ACM Press, New York (2005)
Flatt, M., Krishnamurthi, S., Felleisen, M.: A programmer’s reduction semantics for classes and mixins. In: Alves-Foss, J. (ed.) Formal Syntax and Semantics of Java. LNCS, vol. 1523, pp. 241–269. Springer, Heidelberg (1999)
Gosling, J., et al.: The JavaTM Language Specification, 2nd edn. Addison-Wesley, Reading (June 2000)
Grothoff, C., Palsberg, J., Vitek, J.: Encapsulating objects with confined types. In: Proc. OOPSLA 2001, Tampa, Florida, USA, Oct. 2001, pp. 241–253. ACM Press, New York (2001)
Hindley, J.R.: The principal type-scheme of an object in combinatory logic. Transactions of the American Mathematical Society 146, 29–60 (1969)
Hogg, J.: Islands: Aliasing protection in object-oriented languages. In: Proc. OOPSLA ’91, November 1991, pp. 271–285. ACM Press, New York (1991)
Igarashi, A., Pierce, B.C., Wadler, P.: Featherweight Java: A minimal core calculus for Java and GJ. ACM Transactions on Programming Languages and Systems (TOPLAS) 23(3), 396–450 (2001)
Krishnaswami, N., Aldrich, J.: Permission-based ownership: Encapsulating state in higher-order typed languages. In: Proc. PLDI’05, June 2005, pp. 96–106. ACM Press, New York (2005)
Leino, K.R.M., Müller, P.: Object invariants in dynamic contexts. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, pp. 491–516. Springer, Heidelberg (2004)
Lu, Y., Potter, J.: On ownership and accessibility. In: Thomas, D. (ed.) ECOOP 2006. LNCS, vol. 4067, pp. 99–123. Springer, Heidelberg (2006)
Lu, Y., Potter, J.: Protecting representation with effect encapsulation. In: Proc. POPL ’06, pp. 359–371. ACM Press, New York (2006)
Milner, R.: A theory of type polymorphism in programming. Journal of Computer and System Sciences 17(3), 348–375 (1978)
Müller, P.: Modular Specification and Verification of Object-Oriented Programs. LNCS, vol. 2262. Springer, Heidelberg (2002)
Müller, P., Poetzsch-Heffter, A.: A type system for controlling representation exposure in Java. In: Drossopoulou, et al. (eds.) Formal Techniques for Java Programs. Technical Report 269–5, Fernuniversität Hagen (2000)
Niklaus, M.: Static universe type inference using a sat-solver. Master’s thesis, Software Component Technology Group, Department of Computer Science, ETH Zurich (2006)
Noble, J., Vitek, J., Potter, J.: Flexible alias protection. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 158–185. Springer, Heidelberg (1998)
Odersky, M. (ed.): ECOOP 2004. LNCS, vol. 3086. Springer, Heidelberg (2004)
Palsberg, J., Schwartzbach, M.I.: Object-oriented type inference. In: OOPSLA ’91, Phoenix, Arizona, United States, pp. 146–161. ACM Press, New York (1991)
Pierce, B.C.: Types and programming languages. MIT Press, Cambridge (2002)
Plevyak, J., Chien, A.A.: Precise concrete type inference for object-oriented languages. In: OOPSLA ’94, Portland, Oregon, United States, pp. 324–340. ACM Press, New York (1994)
Poetzsch-Heffter, A., Schäfer, J.: Modular Specification of Encapuslated Object-Oriented Components. In: de Boer, F.S., et al. (eds.) FMCO 2005. LNCS, vol. 4111, pp. 313–341. Springer, Heidelberg (2006)
Potanin, A., et al.: Generic ownership for generic java. In: Proc. OOPSLA 2006, ACM Press, New York (2006)
Robinson, J.A.: Computational logic: The unification computation. Machine Intelligence 6, 63–72 (1971)
Schäfer, J., Poetzsch-Heffter, A.: Simple loose ownership domains. In: ECOOP Workshop on Formal Techniques for Java-like Programs (FTfJP) (Jul. 2006)
Smith, M.: Towards an effects system for ownership domains. In: ECOOP Workshop - FTfJP 2005 (July 2005)
Vitek, J., Bokowski, B.: Confined types in Java. Software – Practice and Experience 31(6), 507–532 (2001)
Zhao, T., Palsberg, J., Vitek, J.: Lightweight confinement for featherweight Java. In: Proc. OOPSLA 2003, October 2003, pp. 135–148. ACM Press, New York (2003)
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2007 Springer Berlin Heidelberg
About this chapter
Cite this chapter
Poetzsch-Heffter, A., Geilmann, K., Schäfer, J. (2007). Infering Ownership Types for Encapsulated Object-Oriented Program Components. In: Reps, T., Sagiv, M., Bauer, J. (eds) Program Analysis and Compilation, Theory and Practice. Lecture Notes in Computer Science, vol 4444. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-71322-7_6
Download citation
DOI: https://doi.org/10.1007/978-3-540-71322-7_6
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-71315-9
Online ISBN: 978-3-540-71322-7
eBook Packages: Computer ScienceComputer Science (R0)