McJava – A Design and Implementation of Java with Mixin-Types

  • Tetsuo Kamina
  • Tetsuo Tamai
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3302)


A programming construct mixin was invented to implement uniform extensions and modifications to classes. Although mixin-based programming has been extensively studied both on the methodological and theoretical point of views, relatively few attempts have been made on designing real programming languages that support mixins. In this paper, we address the issue of how to introduce a feature of declaring a mixin that may also be used as a type to nominally typed object-oriented languages like Java. We propose a programming language McJava, an extension of Java with mixin-types. To study type-soundness of McJava, we have formulated the core of McJava with typing and reduction rules, and proved its type-soundness. We also describe a compilation strategy of McJava that translates McJava programs to Java programs thus eventually making it runnable on standard Java virtual machines.


Java Program Reduction Rule Typing Rule Method Invocation Require Interface 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    GCC home page,
  2. 2.
    Allen, E., Bannet, J., Cartwright, R.: A first-class approach to genericity. In: Proceedings of OOPSLA 2003, pp. 96–114 (2003)Google Scholar
  3. 3.
    Ancona, D., Lagorio, G., Zucca, E.: Jam – A smooth extension of java with mixins. In: Bertino, E. (ed.) ECOOP 2000. LNCS, vol. 1850, pp. 154–178. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  4. 4.
    Ancona, D., Zucca, E.: A theory of mixin modules: Basic and derived operators. Mathematical Structures in Computer Science 8(4), 401–446 (1998)MathSciNetCrossRefMATHGoogle Scholar
  5. 5.
  6. 6.
    Bono, V., Patel, A., Shmatikov, V.: A Core Calculus of Classes and Mixins. In: Guerraoui, R. (ed.) ECOOP 1999. LNCS, vol. 1628, pp. 43–66. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  7. 7.
    Bracha, G.: The Programming Language Jigsaw: Mixins, Modularity and Multiple Inheritance. PhD thesis, University of Utah (1992)Google Scholar
  8. 8.
    Bracha, G., Cook, W.: Mixin-based inheritance. In: OOPSLA 1990, pp. 303–311 (1990)Google Scholar
  9. 9.
    Bracha, G., Lindstrom, G.: Modularity meets inheritance. In: Proceedings of the IEEE Computer Society International Conference on Computer Languages, pp. 282–290. IEEE Computer Society, Los Alamitos (1992)Google Scholar
  10. 10.
    Duggan, D., Sourelis, C.: Mixin modules. In: ICFP 1996, pp. 262–272 (1996)Google Scholar
  11. 11.
    Duggan, D., Techaubol, C.-C.: Modular mixin-based inheritance for application frameworks. In: OOPSLA 2001, pp. 223–240 (2001)Google Scholar
  12. 12.
    Findler, R.B., Flatt, M.: Modular object-oriented programming with units and mixins. In: Proceedings of ICFP 1998, pp. 98–104 (1998)Google Scholar
  13. 13.
    Flatt, M., Krishnamurthi, S., Felleisen, M.: Classes and mixins. In: POPL 1998, pp. 171–183 (1998)Google Scholar
  14. 14.
    Ichisugi, Y., Tanaka, A.: Difference-Based Modules: A Class-Independent Module Mechanism. In: Magnusson, B. (ed.) ECOOP 2002. LNCS, vol. 2374, pp. 62–88. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  15. 15.
    Igarashi, A., Pierce, B., Wadler, P.: Featherweight Java: A minimal core calculus for Java and GJ. ACM TOPLAS 23(3), 396–450 (2001)CrossRefGoogle Scholar
  16. 16.
    Kamina, T., Tamai, T.: A core calculus for mixin-types. In: Foundations on Object Oriented Languages (FOOL11) (2004), Revised version, available at:
  17. 17.
    Kiczales, G., des Rivieres, J., Bobrow, D.G.: The Arts of the Metaobject Protocol. MIT Press, Cambridge (1991)Google Scholar
  18. 18.
    Liskov, B.H., Wing, J.M.: A behavioral notion of subtyping. ACM Transactions on Programming Languages and Systems (TOPLAS) 16(6), 1811–1841 (1994)CrossRefGoogle Scholar
  19. 19.
    McDirmid, S., Flatt, M., Hsieh, W.C.: Jiazzi: New-age components for old-fashioned Java. In: Proceedings of OOPSLA 2001, pp. 211–222 (2001)Google Scholar
  20. 20.
    Moon, D.A.: Object-oriented programming with flavors. In: OOPSLA 1986 Conference Proceedings: Object-Oriented Programming: Systems, Languages, and Applications, pp. 1–8 (1986)Google Scholar
  21. 21.
    Schärli, N., Ducasse, S., Nierstrasz, O., Black, A.: Traits: Composable units of behavior. In: Cardelli, L. (ed.) ECOOP 2003. LNCS, vol. 2743, pp. 248–274. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  22. 22.
    Smaragdakis, Y., Batory, D.: Implementing Layered Designs with Mixin Layers. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 550–570. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  23. 23.
    Stroustrup, B.: The C++ Programming Language, 3rd edn. Addison-Wesley, Reading (1997)MATHGoogle Scholar
  24. 24.
    Tamai, T.: Objects and roles: modeling based on the dualistic view. Information and Software Technology 41(14), 1005–1010 (1999)CrossRefGoogle Scholar
  25. 25.
    Tamai, T.: Evolvable Programming based on Collaboration-Field and Role Model. In: International Workshop on Principles of Software Evolution (IWPSE 2002), pp. 1–5 (2002)Google Scholar
  26. 26.
    Ubayashi, N., Tamai, T.: Separation of Concerns in Mobile Agent Applications. In: Yonezawa, A., Matsuoka, S. (eds.) Reflection 2001. LNCS, vol. 2192, pp. 89–109. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  27. 27.
    VanHislt, M., Notkin, D.: Using C++ templates to implement role-based designs. In: JSSST International Symposium on Object Technologies for Advanced Software, pp. 22–37. Springer, Heidelberg (1996)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Tetsuo Kamina
    • 1
  • Tetsuo Tamai
    • 1
  1. 1.University of TokyoTokyoJapan

Personalised recommendations