Skip to main content

Declarative Object Identity Using Relation Types

  • Conference paper
ECOOP 2007 – Object-Oriented Programming (ECOOP 2007)

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

Included in the following conference series:

Abstract

Object-oriented languages define the identity of an object to be an address-based object identifier. The programmer may customize the notion of object identity by overriding the equals() and hashCode() methods following a specified contract. This customization often introduces latent errors, since the contract is unenforced and at times impossible to satisfy, and its implementation requires tedious and error-prone boilerplate code. Relation types are a programming model in which object identity is defined declaratively, obviating the need for equals() and hashCode() methods. This entails a stricter contract: identity never changes during an execution. We formalize the model as an adaptation of Featherweight Java, and implement it by extending Java with relation types. Experiments on a set of Java programs show that the majority of classes that override equals() can be refactored into relation types, and that most of the remainder are buggy or fragile.

This work has been supported in part by the Defense Advanced Research Projects Agency (DARPA) under contract No. NBCH30390004.

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 84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.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. http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html

  2. T. J. Watson Libraries for Analysis(December 2006), http://wala.sourceforge.net

  3. Allen, E., Chase, D., Hallett, J., Luchangco, V., Maessen, J.-W., Ryu, S., Steele, G., Tobin-Hochstadt, S.:The Fortress language specification, http://research.sun.com/projects/plrg/fortress.pdf

  4. Apache Jakarta Project. BCEL (December 2006), http://jakarta.apache.org/bcel/

  5. Bacon, D.F.: Kava: A Java dialect with a uniform object model for lightweight classes. Concurrency—Practice and Experience 15(3–5), 185–206 (2003)

    Article  MATH  Google Scholar 

  6. Baker, H.G.: Equal rights for functional objects or, the more things change, the more they are the same. OOPS Messenger 4(4), 2–27 (1993)

    Article  Google Scholar 

  7. Bierman, G., Meijer, E., Schulte, W.: The essence of data access in Cω. In: Black, A.P. (ed.) ECOOP 2005. LNCS, vol. 3586, Springer, Heidelberg (2005)

    Google Scholar 

  8. Bierman, G., Parkinson, M.J., Pitts, A.M.MJ.: An imperative core calculus for Java and Java effects. Tech. Rep. 563, Computer Laboratory,University of Cambridge (April 2003)

    Google Scholar 

  9. Bierman, G.M., Wren, A.: First-class relationships in an object-oriented language. In: Black, A.P. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 262–286. Springer, Heidelberg (2005)

    Google Scholar 

  10. Birka, A., Ernst, M.D.: A practical type system and language for reference immutability. In: Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications (OOPSLA’04), pp. 35–49. ACM Press, New York (2004)

    Chapter  Google Scholar 

  11. Blackburn, S.M., Garner, R., Hoffman, C., Khan, A.M., McKinley, K.S., Bentzur, R., Diwan, A., Feinberg, D., Frampton, D., Guyer, S.Z., Hirzel, M., Hosking, A., Jump, M., Lee, H., Moss, J.E.B., Phansalkar, A., Stefanović, D., VanDrunen, T., von Dincklage, D., Wiedermann, B.: The DaCapo benchmarks: Java benchmarking development and analysis. In: Proceedings of the 21st annual ACM SIGPLAN conference on Object-Oriented Programing, Systems, Languages, and Applications (OOPSLA’06), Portland, OR, USA, oct 2006, ACM Press, New York (2006)

    Google Scholar 

  12. Bloch, J.: Effective Java, Programming Language Guide. Addison-Wesley, Reading (2001)

    Google Scholar 

  13. Boyland, J., Noble, J., Retert, W.: Capabilities for sharing: A generalisation of uniqueness and read-only. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 2–27. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  14. Carriero, N., Gelernter, D.: Linda in context. Commun. ACM 32(4), 444–458 (1989)

    Article  Google Scholar 

  15. Charles, P., Grothoff, C., Saraswat, V., Donawa, C., Kielstra, A., Ebcioglu, K., von Praun, C., Sarkar, V.: X10: an object-oriented approach to non-uniform cluster computing. In: Proceedings of the 20th annual ACM SIGPLAN conference on Object oriented programming, systems, languages, and applications (OOPSLA’05), San Diego, CA, USA, pp. 519–538. ACM Press, New York (2005)

    Chapter  Google Scholar 

  16. Dolby, J., Chien, A.: An automatic object inlining optimization and its evaluation. ACM SIGPLAN Notices 35(5), 345–357 (2000)

    Article  Google Scholar 

  17. Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns, Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading (1995)

    Google Scholar 

  18. Goto, E.: Monocopy and Associative Algorithms in an Extended Lisp. Tech. Rep. 74-03, Information Science Laboratory, University of Tokyo (1974)

    Google Scholar 

  19. Igarashi, A., Pierce, B.C, Wadler, P.: Featherweight Java: A minimal core calculus for Java and GJ. ACM Transactions on Programming Languages and Systems 23(3), 396–450 (2001)

    Article  Google Scholar 

  20. Kniesel, G., Theisen, D.: Jac – access right based encapsulation for Java. Software: Practice and Experience 31(6), 555–576 (2001)

    Article  MATH  Google Scholar 

  21. Krall, A., Vitek, J.: On extending Java. In: Mössenböck, H. (ed.) JMLC 1997. LNCS, vol. 1204, Springer, Heidelberg (1997)

    Google Scholar 

  22. Meijer, E., Shulte, W.: Unifying tables, objects and documents. In: DB-COOL (2003)

    Google Scholar 

  23. Michie, D.: Memo functions and machine learning. Nature, 218, 19–22

    Google Scholar 

  24. Microsoft. C# Language Specification. Microsoft Press (2001)

    Google Scholar 

  25. Pechtchanski, I., Sarkar, V.: Immutability specification and its applications. In: Java Grande, pp. 202–211 (2002)

    Google Scholar 

  26. Petter, M.: Personal communication (October 2006)

    Google Scholar 

  27. Peyton-Jones, S., Launchbury, J.: Unboxed values as first class citizens. In: Functional Programming Languages and Computer Architecture. 5th ACM Conference, Berlin, Germany, ACM Press, New York (1991)

    Google Scholar 

  28. Porat, S., Biberstein, M., Koved, L., Mendelson, B.: Automatic detection of immutable fields in Java. In: CASCON (2000)

    Google Scholar 

  29. Tschantz, M.S., Ernst, M.D.: Javari: adding reference immutability to Java. In: Proceedings of the 20th annual ACM SIGPLAN conference on Object oriented programming, systems, languages, and applications (OOPSLA’05), pp. 211–230. ACM Press, New York (2005)

    Chapter  Google Scholar 

  30. van Reeuwijk, C., Sips, H J.: Adding tuples to Java: a study in lightweight data structures. In: JGI’02 (2002)

    Google Scholar 

  31. Vaziri, M., Tip, F., Dolby, J.: Associating synchronization constraints with data in an object-oriented language. In: POPL ’06: Conference record of the 33rd ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pp. 334–345. ACM Press, New York, NY, USA (2006)

    Chapter  Google Scholar 

  32. Vaziri, M., Tip, F., Fink, S., Dolby, J.: Declarative object identity using relation types. Tech. rep. IBM Research (Forthcoming 2007)

    Google Scholar 

  33. Yelick, K., Semenzato, L., Pike, G., Miyamoto, C., Liblit, B.: abd Paul Hilfinger, A. K., Graham, S., Gay, D., Colella, P., and Aiken, A. Titanium: A high-performance Java dialect. Concurrency—Practice and Experience, Java Special Issue (1998)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Erik Ernst

Rights and permissions

Reprints and permissions

Copyright information

© 2007 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Vaziri, M., Tip, F., Fink, S., Dolby, J. (2007). Declarative Object Identity Using Relation Types. In: Ernst, E. (eds) ECOOP 2007 – Object-Oriented Programming. ECOOP 2007. Lecture Notes in Computer Science, vol 4609. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-73589-2_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-73589-2_4

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-73588-5

  • Online ISBN: 978-3-540-73589-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics