JavaGI: Generalized Interfaces for Java

  • Stefan Wehr
  • Ralf Lämmel
  • Peter Thiemann
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4609)

Abstract

JavaGI is an experimental language that extends Java 1.5 by generalizing the interface concept to incorporate the essential features of Haskell’s type classes. In particular, generalized interfaces cater for retroactive and constrained interface implementations, binary methods, static methods in interfaces, default implementations for interface methods, interfaces over families of types, and existential quantification for interface-bounded types. As a result, many anticipatory uses of design patterns such as Adapter, Factory, and Visitor become obsolete; several extension and integration problems can be solved more easily. JavaGI’s interface capabilities interact with subtyping (and subclassing) in interesting ways that go beyond type classes. JavaGI can be translated to Java 1.5. Its formal type system is derived from Featherweight GJ.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Bracha, G.: Generics in the Java programming language (July 2004), http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf
  2. 2.
    Bracha, G., Odersky, M., Stoutamire, D., Wadler, P.: Making the future safe for the past: Adding genericity to the Java programming language. In: Proc. 13th ACM Conf. OOPSLA, Vancouver, BC, October 1998, pp. 183–200. ACM Press, New York (1998)Google Scholar
  3. 3.
    Bruce, K.B., Cardelli, L., Castagna, G., Eifrig, J., Smith, S.F., Trifonov, V., Leavens, G.T., Pierce, B.C.: On binary methods. Theory and Practice of Object Systems 1(3), 221–242 (1995)Google Scholar
  4. 4.
    Bruce, K.B., Foster, J.N.: LOOJ: Weaving LOOM into Java. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, pp. 389–413. Springer, Heidelberg (2004)Google Scholar
  5. 5.
    Bruce, K.B., Odersky, M., Wadler, P.: A statically safe alternative to virtual types. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 523–549. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  6. 6.
    Bruce, K.B., Petersen, L., Fiech, A.: Subtyping is not a good ”match” for object-oriented languages. In: Aksit, M., Matsuoka, S. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 104–127. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  7. 7.
    Bruce, K.B., Schuett, A., van Gent, R., Fiech, A.: PolyTOIL: A type-safe polymorphic object-oriented language. ACM Trans. Prog. Lang. and Systems 25(2), 225–290 (2003)CrossRefGoogle Scholar
  8. 8.
    Chakravarty, M.M.T., Keller, G., Jones, S.P.: Associated type synonyms. In: Pierce, B.C. (ed.) Proc. Intl. Conf. Functional Programming 2005, Tallinn, Estonia, September 2005, pp. 241–253. ACM Press, New York (2005)Google Scholar
  9. 9.
    Chakravarty, M.M.T., Keller, G., Jones, S.P., Marlow, S.: Associated types with class. In: Abadi, M. (ed.) Proc. 32nd ACM Symp. POPL, Long Beach, CA, January 2005, pp. 1–13. ACM Press, New York (2005)Google Scholar
  10. 10.
    Chambers, C.: Object-oriented multi-methods in Cecil. In: Madsen, O.L. (ed.) ECOOP 1992. LNCS, vol. 615, pp. 33–56. Springer, Heidelberg (1992)CrossRefGoogle Scholar
  11. 11.
    Clifton, C., Millstein, T., Leavens, G.T., Chambers, C.: MultiJava: Design rationale, compiler implementation, and applications. ACM Trans. Prog. Lang. and Systems 28(3), 517–575 (2006)CrossRefGoogle Scholar
  12. 12.
    Ernst, E.: Family polymorphism. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 303–326. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  13. 13.
    Ernst, E., Ostermann, K., Cook, W.R.: A virtual class calculus. In: Jones, S.P. (ed.) Proc. 33rd ACM Symp. POPL, Charleston, South Carolina, January 2006, pp. 270–282. ACM Press, New York (2006)Google Scholar
  14. 14.
    Eugster, P.: Uniform proxies for Java. In: Proc. 21th ACM Conf. OOPSLA, Portland, OR, pp. 139–152. ACM Press, New York (2006)Google Scholar
  15. 15.
    Hall, C.V., Hammond, K., Jones, S.L.P., Wadler, P.L.: Type classes in Haskell. ACM Trans. Prog. Lang. and Systems 18(2), 109–138 (1996)CrossRefGoogle Scholar
  16. 16.
    Helm, R., Holland, I.M., Gangopadhyay, D.: Contracts: specifying behavioral compositions in object-oriented systems. In: Conf. OOPSLA / ECOOP, Ottawa, Canada, October 1990, vol. 25(10), pp. 169–180 (1990)Google Scholar
  17. 17.
    Igarashi, A., Pierce, B.C., Wadler, P.: Featherweight Java: a minimal core calculus for Java and GJ. ACM Trans. Prog. Lang. and Systems 23(3), 396–450 (2001)CrossRefGoogle Scholar
  18. 18.
    Jones, M.P.: Type classes with functional dependencies. In: Smolka, G. (ed.) ESOP 2000 and ETAPS 2000. LNCS, vol. 1782, pp. 230–244. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  19. 19.
    Järvi, J., Willcock, J., Lumsdaine, A.: Associated types and constraint propagation for mainstream object-oriented generics. In: Proc. 20th ACM Conf. OOPSLA, pp. 1–19. ACM Press, New York (2005)Google Scholar
  20. 20.
    Kaes, S.: Parametric overloading in polymorphic programming languages. In: Ganzinger, H. (ed.) ESOP 1988. LNCS, vol. 300, pp. 131–144. Springer, Heidelberg (1988)Google Scholar
  21. 21.
    Kennedy, A., Syme, D.: Design and implementation of generics for the .NET common language runtime. In: Proc. 2001 PLDI, Snowbird, UT, June 2001, pp. 1–12. ACM Press, New York (2001)CrossRefGoogle Scholar
  22. 22.
    Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., Griswold, W.G.: An Overview of AspectJ. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 327–353. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  23. 23.
    Lämmel, R., Ostermann, K.: Software extension and integration with type classes. In: GPCE ’06, pp. 161–170. ACM Press, New York (2006)CrossRefGoogle Scholar
  24. 24.
    Madsen, O.L., Møller-Pedersen, B., Nygaard, K.: Object-Oriented Programming in the BETA Programming Language. Addison-Wesley, Reading (1993)Google Scholar
  25. 25.
    Microsoft Corp. C# Version 3.0 Specification (May 2006), http://msdn2.microsoft.com/en-us/vcsharp/aa336745.aspx
  26. 26.
    Millstein, T., Reay, M., Chambers, C.: Relaxed MultiJava: Balancing extensibility and modular typechecking. In: Proc. 18th ACM Conf. OOPSLA, Anaheim, CA, pp. 224–240. ACM Press, New York (2003)Google Scholar
  27. 27.
    Odersky, M.: The scala language specification version 2.0, Draft (November 2006), http://scala.epfl.ch/docu/files/ScalaReference.pdf
  28. 28.
    Odersky, M., Zenger, M.: Scalable component abstractions. In: Proc. 20th ACM Conf. OOPSLA, San Diego, CA, 2005, pp. 41–58. ACM Press, New York (2005)Google Scholar
  29. 29.
    Peyton Jones, S. (ed.): Haskell 98 Language and Libraries, The Revised Report. Cambridge University Press, Cambridge (2003)Google Scholar
  30. 30.
    Peyton Jones, S., Jones, M., Meijer, E.: Type classes: An exploration of the design space. In: Launchbury, J. (ed) Proc. of the Haskell Workshop, Amsterdam, June 1997, The Netherlands (1997)Google Scholar
  31. 31.
    Sekharaiah, K.C., Ram, D.J.: Object schizophrenia problem in object role system design. In: Bellahsène, Z., Patel, D., Rolland, C. (eds.) OOIS 2002. LNCS, vol. 2425, pp. 494–506. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  32. 32.
    Siek, J., Lumsdaine, A.: Essential language support for generic programming. In: Proc. 2005 ACM Conf. PLDI, June 2005, pp. 73–84. ACM Press, New York (2005)Google Scholar
  33. 33.
    Torgersen, M.: The expression problem revisited — four new solutions using generics. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, Springer, Heidelberg (2004)Google Scholar
  34. 34.
    Torgersen, M., Ernst, E., Hansen, C.P.: Wild FJ. In: International Workshop on Foundations of Object-Oriented Languages, informal proceedings (2005)Google Scholar
  35. 35.
    Torgersen, M., Ernst, E., Hansen, C.P., von der Ahé, P., Bracha, G., Gafter, N.: Adding wildcards to the java programming language. Journal of Object Technology 3(11), 97–116 (2004)Google Scholar
  36. 36.
    Wadler, P.: The expression problem, Posted on Java Genericity mailing list (1998)Google Scholar
  37. 37.
    Wadler, P., Blott, S.: How to make ad-hoc polymorphism less ad-hoc. In: Proc. 16th ACM Symp. POPL, Austin, Texas, January 1989, pp. 60–76. ACM Press, New York (1989)Google Scholar
  38. 38.
    Warth, A., Stanojevic, M., Millstein, T.: Statically scoped object adaptation with expanders. In: Proc. 21th ACM Conf. OOPSLA, Portland, OR, 2006, pp. 37–56. ACM Press, New York (2006)Google Scholar
  39. 39.
    Yu, D., Kennedy, A., Syme, D.: Formalization of generics for the .NET common language runtime. In: Leroy, X. (ed.) Proc. 31st ACM Symp. POPL, Venice, Italy, January 2004, pp. 39–51. ACM Press, New York (2004)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2007

Authors and Affiliations

  • Stefan Wehr
    • 1
  • Ralf Lämmel
    • 2
  • Peter Thiemann
    • 1
  1. 1.Institut für Informatik, Universität Freiburg 
  2. 2.Microsoft Corp., Redmond 

Personalised recommendations