Immutable Objects for a Java-Like Language

  • C. Haack
  • E. Poll
  • J. Schäfer
  • A. Schubert
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4421)

Abstract

We extend a Java-like language with immutability specifications and a static type system for verifying immutability. A class modifier immutable specifies that all class instances are immutable objects. Ownership types specify the depth of object states and enforce encapsulation of representation objects. The type system guarantees that the state of immutable objects does not visibly mutate during a program run. Provided immutability-annotated classes and methods are final, this is true even if immutable classes are composed with untrusted classes that follow Java’s type system, but not our immutability type system.

References

  1. [BE04]
    Birka, A., Ernst, M.D.: A practical type system and language for reference immutability. In: OOPSLA’04, October 26–28, 2004, pp. 35–49 (2004)Google Scholar
  2. [Blo01]
    Bloch, J.: Effective Java. Addison-Wesley, Reading (2001)Google Scholar
  3. [BLS03]
    Boyapati, C., Liskov, B., Shrira, L.: Ownership types for object encapsulation. In: POPL’03, pp. 213–223 (2003)Google Scholar
  4. [CD02]
    Clarke, D., Drossopoulou, S.: Ownership, encapsulation and the disjointness of type and effect. In: OOPSLA’02, pp. 292–310 (2002)Google Scholar
  5. [CPN98]
    Clarke, D., Potter, J., Noble, J.: Ownership types for flexible alias protection. In: OOPSLA’98, pp. 48–64 (1998)Google Scholar
  6. [DM05]
    Dietl, W., Müller, P.: Universes: Lightweight ownership for JML. Journal of Object Technology (JOT) 4(8), 5–32 (2005)Google Scholar
  7. [Goe02]
    Goetz, B.: Java theory and practice: Safe construction techniques–don’t let the ”this” reference escape during construction. IBM DevelopersWork (2002), http://www-106.ibm.com/developerworks/java/library/j-jtp0618.html
  8. [HPSS07]
    Haack, C., et al.: Immutable objects for a Java-like language. Technical report, Radboud University Nijmegen, Forthcoming (2007)Google Scholar
  9. [IPW01]
    Igarashi, A., Pierce, B., Wadler, P.: Featherweight Java: a minimal core calculus for Java and GJ. ACM TOPLAS 23(3), 396–450 (2001), doi:10.1145/503502.503505CrossRefGoogle Scholar
  10. [LP06a]
    Lu, Y., Potter, J.: On ownership and accessibility. In: Thomas, D. (ed.) ECOOP 2006. LNCS, vol. 4067, pp. 99–123. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  11. [LP06b]
    Lu, Y., Potter, J.: Protecting representation with effect encapsulation. In: POPL’06, pp. 359–371. ACM Press, New York (2006)Google Scholar
  12. [MPH01]
    Müller, P., Poetzsch-Heffter, A.: Universes: A type system for alias and dependency control. Technical Report 279, Fernuniversität Hagen (2001)Google Scholar
  13. [PBKM00]
    Porat, S., et al.: Automatic detection of immutable fields in Java. In: CASCON’02, IBM Press, Indianapolis (2000)Google Scholar
  14. [PS05]
    Pechtchanski, I., Sarkar, V.: Immutability specification and applications. Concurrency and Computation: Practice and Experience 17, 639–662 (2005)CrossRefGoogle Scholar
  15. [Sch04]
    Schäfer, J.: Encapsulation and specification of object-oriented runtime components. Master’s thesis, Technische Universität Kaiserslautern (2004)Google Scholar
  16. [SR05]
    Salcianu, A., Rinard, M.C.: Purity and side effect analysis for Java programs. In: Cousot, R. (ed.) VMCAI 2005. LNCS, vol. 3385, pp. 199–215. Springer, Heidelberg (2005)Google Scholar
  17. [TE05]
    Tschantz, M.S., Ernst, M.D.: Javari: Adding reference immutability to Java. In: OOPSLA’05, October 18–20, 2005, pp. 211–230 (2005)Google Scholar
  18. [VB01]
    Vitek, J., Bokowski, B.: Confined types in Java. Softw. Pract. Exper. 31(6), 507–532 (2001)MATHCrossRefGoogle Scholar
  19. [WF94]
    Wright, A.K., Felleisen, M.: A syntactic approach to type soundness. Information and Computation 115(1), 38–94 (1994)MATHCrossRefMathSciNetGoogle Scholar
  20. [ZPV06]
    Zhao, T., Palsberg, J., Vitek, J.: Type-based confinement. Journal of Functional Programming 16(1), 83–128 (2006)MATHCrossRefMathSciNetGoogle Scholar

Copyright information

© Springer Berlin Heidelberg 2007

Authors and Affiliations

  • C. Haack
    • 1
  • E. Poll
    • 1
  • J. Schäfer
    • 2
  • A. Schubert
    • 1
    • 3
  1. 1.Radboud Universiteit NijmegenThe Netherlands
  2. 2.Technische Universität KaiserlauternGermany
  3. 3.Warsaw UniversityPoland

Personalised recommendations