skip to main content
10.1145/1297027.1297064acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
Article

The java module system: core design and semantic definition

Published:21 October 2007Publication History

ABSTRACT

Java has no module system. Its packages only subdivide the class name space, allowing only a very limited form of component-level information hiding and reuse. Two Java Community Processes have started addressing this problem: one describes the runtime system and has reached an early draft stage, while the other considers the developer's view and only has a straw-man proposal. Both are natural language documents, which inevitably contain ambiguities.

In this work we design and formalize a core module system for Java. Where the JCP documents are complete, we follow them closely; elsewhere we make reasonable choices. We define the syntax, the type system, and the operational semantics of an LJAM language, defining these rigorously in the Isabelle/HOL automated proof assistant. Using this formalization, we identify various issues with the module system. We highlight the underlying design decisions, and discuss several alternatives and their benefits. Our Isabelle/HOL definitions should provide a basis for further consideration of the design alternatives, for reference implementations, and for proofs of soundness.

References

  1. Apache Felix. http://cwiki.apache.org/felix/.Google ScholarGoogle Scholar
  2. Eclipse Callisto. http://www.eclipse.org/callisto/.Google ScholarGoogle Scholar
  3. Equinox. http://www.eclipse.org/equinox/.Google ScholarGoogle Scholar
  4. Fusion. http://en.wikipedia.org/wiki/.NET_assembly#Fusion.Google ScholarGoogle Scholar
  5. Ancona, D., Damiani, F., Drossopoulou, S., and Zucca, E. Polymorphic Bytecode: Compositional Compilation for Java-like Languages. In Proc32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL'05 (Long Beach, CA, USA, Jan12-14, 2005), J. Palsberg and M. Abadi, Eds., ACM, pp. 26--37. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Ancona, D., Lagorio, G., and Zucca, E. Jam -a smooth extension of java with mixins. In ProcEuropean Conference on Object-Oriented Programming, ECOOP'00 (Sophia Antipolis and Cannes, France, June 12--16, 2000), E. Bertino, Ed., vol. 1850 of Lecture Notes in Computer Science, Springer, pp. 154--178. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Ancona, D., Lagorio, G., and Zucca, E. Smart Modules for Java-like Languages. In Proc7th Workshop on Formal Techniques for Java-like Programs, FTfJP'05 (Glasgow, Scotland, July 26, 2005).Google ScholarGoogle Scholar
  8. Ancona, D., and Zucca, E. True Modules for Java-like Languages. In ProcEuropean Conference on Object-Oriented Programming, ECOOP'01 (Budapest, Hungary, June18-22, 2001), JL. Knudsen, Ed., vol. 2072 of Lecture Notes in Computer Science, Springer, pp. 354--380. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Bierman, G., Parkinson, M., and Pitts, A. MJ: An imperative core calculus for Java and Java with Effects. Tech. Rep. 563, Cambridge University Computer Laboratory, Apr. 2003.Google ScholarGoogle Scholar
  10. Bracha, G. Developing Modules for Development. http://blogs.sun.com/gbracha/, Mar. 2006.Google ScholarGoogle Scholar
  11. Bracha, G. Superpackages: Development Modules in Dolphin. In ProcJavaOneSM Conference (2006), Sun Microsystems, Inc.Google ScholarGoogle Scholar
  12. Corwin, J., Bacon, D. F., Grove, D., and Murthy, C. MJ: a rational module system for Java and its applications. In ProcACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications, OOPSLA'03(Anaheim, CA, USA, Oct. 26--30, 2003), RCrocker and GLS. Jr., Eds., ACM, pp. 241--254. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. DevelopMentor. Assemblies Module -.NET: Building Applications and Components with C#, Jan. 2004.Google ScholarGoogle Scholar
  14. Flatt, M., Krishnamurthi, S., and Felleisen, M. A Programmer's reduction semantics for classes and mixins. Tech. Rep. TR-97-293, Rice University, 1997. Corrected June, 1999.Google ScholarGoogle Scholar
  15. Gosling, J., Joy, B., Stelle, G., and Bracha, G. The Java™ Language Specification, Third. ed. Sun Microsystems, Inc., May 2005.Google ScholarGoogle Scholar
  16. Igarashi, A., Pierce, B. C., and Wadler, P. Featherweight Java: a minimal core calculus for Java and GJ. ACM Trans. Program. Lang. Syst. 23, 3 (2001), 396--450. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Klein, G., and Nipkow, T. A Machine-Checked Model for a Java-Like Language, Virtual Machine and Compiler. ACM Transactions on Programming Languages and Systems, TOPLAS'06 28, 4 (July 2006), 619--695. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Liang, S., and Bracha, G. Dynamic Class Loading in the Java Virtual Machine. In ProcACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications, OOPSLA'98 (Vancouver, British Columbia, Canada, Oct. 18--22, 1998), pp. 36--44. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. McDirmid, S., Flatt, M., and Hsieh, W. Jiazzi: New Age Components for Old Fashioned Java. In ProcACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications, OOPSLA'01 (Tampa, Florida, USA, Nov. 2001), vol. 36, pp. 211--222. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Microsoft. C# Specification, 2.0 ed., Sept. 2005.Google ScholarGoogle Scholar
  21. Nipkow, T., Paulson, L. C., and Wenzel, M. Isabelle/HOL -A Proof Assistant for Higher-Order Logic, vol. 2283 of Lecture Notes in Computer Science. Springer, 2002.Google ScholarGoogle Scholar
  22. OSGi™ Alliance. About the OSGi Service Platform, 4.1 ed., Nov. 2005.Google ScholarGoogle Scholar
  23. Robinson, R. Developing and Deploying Modular J2EE Applications with WebSphere Studio Application Developer and WebSphere Application Server. http://www-128.ibm.com/developerworks/websphere/library/techarticles/02%06_robinson/robinson.html, June 2002.Google ScholarGoogle Scholar
  24. Seco, J. C., and Caires, L. A Basic Model of Typed Components. In ProcEuropean Conference on Object-Oriented Programming, ECOOP'00 (Sophia Antipolis and Cannes, France, June 12--16, 2000), E. Bertino, Ed., vol. 1850 of Lecture Notes in Computer Science, Springer, pp. 108--128. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Sewell, P., Zappa Nardelli, F., Owens, S., Peskine, G., Ridge, T., Sarkar, S., and Strniša, R. Ott: Effective Tool Support for the Working Semanticist. In ProcICFP (Freiburg, Germany, Oct. 2007). To appear in ICFP'07. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Strniša, R. Lightweight Java Module System. http://www.cl.cam.ac.uk/~rs456/ljam, Feb. 2007.Google ScholarGoogle Scholar
  27. Strniša, R., and Parkinson, M. Lightweight Java. http://www.cl.cam.ac.uk/~rs456/lj, Sept. 2006.Google ScholarGoogle Scholar
  28. Sun Microsystems, Inc. Java™ SE 7. https://jdk7.dev.java.net/. In development.Google ScholarGoogle Scholar
  29. Sun Microsystems, Inc. JSR-294: Improved Modularity Support in the Java™ Programming Language. http://jcp.org/en/jsr/detail?id=294.Google ScholarGoogle Scholar
  30. Sun Microsystems, Inc. OpenJDK: Modules project. http://openjdk.java.net/projects/modules/.Google ScholarGoogle Scholar
  31. Sun Microsystems, Inc. JSR-277: Java™ Module System. http://jcp.org/en/jsr/detail?id=277, Oct. 2006. Early Draft.Google ScholarGoogle Scholar
  32. Zenger, M. Programming Language Abstractions for Extensible Software Components. PhD thesis, University of Lausanne, EPFL, 2003.Google ScholarGoogle Scholar

Index Terms

  1. The java module system: core design and semantic definition

          Recommendations

          Reviews

          Alexandre Bergel

          The use of packages and class loaders in Java does not help in managing several different versions of the same software unit in a satisfactory way. As expressed by the authors, this situation is traditionally referenced as dynamic-link library (DLL) or Java Archive (JAR) hell. Java Module System (JAM) is the latest of several attempts by the Java community to define a practical module system. The main feature of JAM is to add visibility restriction to packages using hierarchical information hiding, while being backward compatible with Java. JAM supports "super package," a new kind of compilation unit, to embody packages. Packages may be imported and exported to other super packages. A repository acts as a scoping mechanism by containing one module instance at most. A module definition (no matter what version) can be found from within the same repository, or any repository related to that repository through the "child" relation. The authors present a rigorous formalization and an extended discussion on various aspects of JAM. Other module systems, such as MZScheme's units [1] and Expanders [2], enable different class versions to be in use in the same executing application. JAM restricts one single module instance per repository, which implies that no more than one class version may be present at execution within the same control flow. One point that may leave a reader unsure has to do with interaction with legacy code. Recent major changes in Java, such as generics, show the importance of linking legacy code to new libraries that use the new features, and vice versa. The paper does not provide any convincing hints that go in that direction. With that said, this paper makes a strong and clear contribution, and provides an answer for a pressing need. Online Computing Reviews Service

          Access critical reviews of Computing literature here

          Become a reviewer for Computing Reviews.

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in
          • Published in

            cover image ACM Conferences
            OOPSLA '07: Proceedings of the 22nd annual ACM SIGPLAN conference on Object-oriented programming systems, languages and applications
            October 2007
            728 pages
            ISBN:9781595937865
            DOI:10.1145/1297027
            • cover image ACM SIGPLAN Notices
              ACM SIGPLAN Notices  Volume 42, Issue 10
              Proceedings of the 2007 OOPSLA conference
              October 2007
              686 pages
              ISSN:0362-1340
              EISSN:1558-1160
              DOI:10.1145/1297105
              Issue’s Table of Contents

            Copyright © 2007 ACM

            Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 21 October 2007

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • Article

            Acceptance Rates

            OOPSLA '07 Paper Acceptance Rate33of156submissions,21%Overall Acceptance Rate268of1,244submissions,22%

            Upcoming Conference

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader