I’ve started drafting an overview of the current state of our work on Project Jigsaw. Ultimately this will be a fairly long document, but in order to start getting feedback as early possible I’ve published the first part on its own. This initial installment covers design principles, basic definitions, and module declarations; still to come are sections on compilation, packaging, libraries, repositories, the module-system API, and the modularization of the JDK.
The Jigsaw module system is designed to be both approachable and scalable: Approachable by all developers, yet sufficiently scalable to support the modularization of large legacy software systems in general and the JDK in particular. It aims to implement a set of general requirements; its detailed design has been further guided by the following principles:
Modularity is a language construct — The best way to support modular programming in a standard way in the Java platform is to extend the language itself to support modules. Developers already think about standard kinds of program components such as classes and interfaces in terms of the language. Modules should be just another kind of program component, and like classes and interfaces they should have meaning in all phases of a program’s development.
Module boundaries should be strongly enforced — A class that is private to a module should be private in exactly the same way that a private field is private to a class. In other words, module boundaries should determine not just the visibility of classes and interfaces but also their accessibility. Without this guarantee it is impossible to construct modular systems capable of running untrusted code securely.
Static, single-version resolution is usually sufficient — Most applications do not need to add or remove modules dynamically at run time, nor do they need to use multiple versions of the same module simultaneously. The module system should be optimized for common scenarios but also support narrowly-scoped forms of dynamic multi-version resolution motivated by actual use cases such as, e.g., application servers, IDEs, and test harnesses.
There are already plenty of module systems built on top of the Java platform. What’s new about the Jigsaw module system is that it’s designed to be an integral part of the platform. The design assumes the possibility of changing the Java language and the Java virtual machine, thereby enabling both linguistic support for modular programming and secure encapsulation.
For more details see the draft. Please send comments, questions, and suggestions to the jigsaw-dev mailing list. (If you haven’t already subscribed to that list then please do so first, otherwise your message will be discarded as spam.)