Skip to main content

Infering Ownership Types for Encapsulated Object-Oriented Program Components

  • Chapter
Program Analysis and Compilation, Theory and Practice

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 4444))

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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)

    Google Scholar 

  2. 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)

    Google Scholar 

  3. 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)

    Google Scholar 

  4. 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)

    Chapter  Google Scholar 

  5. Boyapati, C.: SafeJava: A Unified Type System for Safe Programming. PhD thesis, Massachusetts Institute of Technology (February 2004)

    Google Scholar 

  6. 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)

    Google Scholar 

  7. 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)

    Google Scholar 

  8. 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)

    Google Scholar 

  9. Clarke, D.: Object Ownership and Containment. PhD thesis, University of New South Wales (July 2001)

    Google Scholar 

  10. 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)

    Google Scholar 

  11. 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)

    Google Scholar 

  12. 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)

    Chapter  Google Scholar 

  13. Detlefs, D.L., et al.: Wrestling with rep exposure. Research Report 156, Digital Systems Research Center, SRC-RR-156 (July 1998)

    Google Scholar 

  14. Dietl, W., Müller, P.: Universes: Lightweight ownership for JML. Journal of Object Technology 4(8), 5–32 (2005)

    Google Scholar 

  15. Donovan, A., et al.: Converting java programs to use generic libraries. In: OOPSLA ’04, Vancouver, Canada, pp. 15–34. ACM Press, New York (2004)

    Chapter  Google Scholar 

  16. Flanagan, C., Freund, S.N., Lifshin, M.: Type inference for atomicity. In: Proc. TLDI ’05, pp. 47–58. ACM Press, New York (2005)

    Google Scholar 

  17. 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)

    Chapter  Google Scholar 

  18. Gosling, J., et al.: The JavaTM Language Specification, 2nd edn. Addison-Wesley, Reading (June 2000)

    Google Scholar 

  19. 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)

    Google Scholar 

  20. Hindley, J.R.: The principal type-scheme of an object in combinatory logic. Transactions of the American Mathematical Society 146, 29–60 (1969)

    Article  MathSciNet  MATH  Google Scholar 

  21. Hogg, J.: Islands: Aliasing protection in object-oriented languages. In: Proc. OOPSLA ’91, November 1991, pp. 271–285. ACM Press, New York (1991)

    Google Scholar 

  22. 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)

    Article  Google Scholar 

  23. 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)

    Google Scholar 

  24. 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)

    Google Scholar 

  25. Lu, Y., Potter, J.: On ownership and accessibility. In: Thomas, D. (ed.) ECOOP 2006. LNCS, vol. 4067, pp. 99–123. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  26. Lu, Y., Potter, J.: Protecting representation with effect encapsulation. In: Proc. POPL ’06, pp. 359–371. ACM Press, New York (2006)

    Google Scholar 

  27. Milner, R.: A theory of type polymorphism in programming. Journal of Computer and System Sciences 17(3), 348–375 (1978)

    Article  MathSciNet  MATH  Google Scholar 

  28. Müller, P.: Modular Specification and Verification of Object-Oriented Programs. LNCS, vol. 2262. Springer, Heidelberg (2002)

    MATH  Google Scholar 

  29. 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)

    Google Scholar 

  30. Niklaus, M.: Static universe type inference using a sat-solver. Master’s thesis, Software Component Technology Group, Department of Computer Science, ETH Zurich (2006)

    Google Scholar 

  31. Noble, J., Vitek, J., Potter, J.: Flexible alias protection. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 158–185. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  32. Odersky, M. (ed.): ECOOP 2004. LNCS, vol. 3086. Springer, Heidelberg (2004)

    Google Scholar 

  33. Palsberg, J., Schwartzbach, M.I.: Object-oriented type inference. In: OOPSLA ’91, Phoenix, Arizona, United States, pp. 146–161. ACM Press, New York (1991)

    Chapter  Google Scholar 

  34. Pierce, B.C.: Types and programming languages. MIT Press, Cambridge (2002)

    Google Scholar 

  35. 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)

    Chapter  Google Scholar 

  36. 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)

    Chapter  Google Scholar 

  37. Potanin, A., et al.: Generic ownership for generic java. In: Proc. OOPSLA 2006, ACM Press, New York (2006)

    Google Scholar 

  38. Robinson, J.A.: Computational logic: The unification computation. Machine Intelligence 6, 63–72 (1971)

    Google Scholar 

  39. Schäfer, J., Poetzsch-Heffter, A.: Simple loose ownership domains. In: ECOOP Workshop on Formal Techniques for Java-like Programs (FTfJP) (Jul. 2006)

    Google Scholar 

  40. Smith, M.: Towards an effects system for ownership domains. In: ECOOP Workshop - FTfJP 2005 (July 2005)

    Google Scholar 

  41. Vitek, J., Bokowski, B.: Confined types in Java. Software – Practice and Experience 31(6), 507–532 (2001)

    Article  MATH  Google Scholar 

  42. 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)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Thomas Reps Mooly Sagiv Jörg Bauer

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics