Movatterモバイル変換


[0]ホーム

URL:


Java Platform Module System: Requirements

Mark Reinhold

2015/4/1 16:46 -0700 [1b782d553f02]
Copyright © 2015 Oracle and/or its affiliates · All Rights Reserved
This version:http://openjdk.java.net/projects/jigsaw/spec/reqs/2015-04-01
Latest version:http://openjdk.java.net/projects/jigsaw/spec/reqs/

The overall goal of this JSR is to define an approachableyet scalable module system for the Java Platform. It will beapproachable,i.e., easy to learn and easy to use, so that developerscan use it to construct and maintain libraries and large applications forboth the Java SE and Java EE Platforms. It will be scalable so that itcan be used to modularize the Java SE Platform itself, and itsimplementations.

As outlinedin the JSR, the specific goals are toprovide and enable:

This document expands the above goals into a set of sub-goals, orrequirements, and also some non-requirements, which identify goals thatare beyond the scope of this JSR. Each (non-)requirement is shown as

Motivational or explanatory comments sometimes follow a requirement, innon-indented text.

The intent of this document is to serve as a set ofguideposts for the deliberations of this JSR’sExpert Group.The specification will, ultimately, satisfy all of these requirements.Revisions may be proposed after we finalize this document, but the barfor accepting them will be relatively high.

The terms “must,” “must not,” “required,” “shall,” “shallnot,” “should,” “should not,” “recommended,” “may,” and “optional” inthis document are to be interpreted as described inRFC2119.

Contents

Fundamentals

Modules ·Dependences ·Resolution ·Exports ·Encapsulation ·Non-interference ·Resource encapsulation ·Services ·Binding ·Selective binding ·Fidelity across all phases ·Protection domains ·Compatible Java Platform modularization ·Refactoring ·Interoperation

Modularizing the Java SE Platform

Medium-grained modularization ·Qualified exports ·Overrideable encapsulation ·Upgradeable modules ·Referential integrity ·Preserve performance

Development

Gradual migration of applications ·Integrate smoothly with existing tools ·Multi-mode artifacts ·White-box testing ·Reflection, debugging, and tools ·Readable artifacts ·Efficient annotation detection

Linking

Linking tool ·Link-time optimization

Packaging

OS-specific module packaging ·OS-specific application packaging

Versioning

Version strings ·Non-prescriptive version strings ·Version strings in reflective APIs

Dynamic Configuration

Basic dynamic configuration ·Run-time augmentation of platform modules ·Multiple dynamic configurations ·Isolated dynamic configurations ·Composable dynamic configurations ·Alternate module versions in dynamic configurations ·Control of class loaders

Non-Requirements

Modularize the Java Language Specification ·Modularize the Java Virtual Machine Specification ·Multiple versions ·Version selection

Fundamentals

Like a package, class, or interface, a module has both a specificationand one or more implementations. It is a large-grained unit ofcompilation, packaging, release, transport, and re-use.

In this context the invoking agent might be a developer, via command-lineflags or build-system configuration settings, or it might be anapplication that dynamically loads modules, via an appropriate API.

Modularizing the Java SE Platform

A module that exports one or more packages of the Java SE Platform willhereinafter be referred to as a “platform module.”

Development

This will allow library developers to continue to produce a singleartifact for both class-path and module-based applications.

One potential approach is to augment a module’s definition with an indexof the annotations that are present in the module, together with anindication of the elements to which each annotation applies. To limitthe size of the index, only annotations which themselves are annotatedwith a new meta-annotation, say@Indexed, would be included.

Linking

The result of the linking process may be a minimal Java run-time systemintegrated tightly with a single application and its libraries, an entireJava development environment, or something in between these two extremes.

Packaging

This requirement does not apply to operating systems that do not havebuilt-in, general-purpose packaging systems, such as Windows and Mac OS.

If the target system is expected already to include the necessaryplatform modules then they need not be included in the applicationpackage.

Versioning

Dynamic Configuration

The requirements for dynamic configuration are motivated by applicationswith plug-in or container architectures such as IDEs, test harnesses, andapplication servers. For the Java EE Platform, in particular, the goalis to enable a future modularwar-file standard in which the componentsin awar file can be modules.

This will allow a container application to load additional platformmodules in order to satisfy the needs of the applications that it hosts.

A canonical example of using multiple versions of an upgradeable modulein a Java EE environment is that of a web application requiring adifferent version of the JAX-WS stack than is already available to theweb container.

Non-Requirements

A particular JVM implementation may, of course, have its own internalmodular structure, but there is no compelling need to subdivide eitherthe language or the VM specifications.

Most applications are not containers and, since they currently rely uponthe class path, do not require the ability to load multiple versions of amodule. Container-type applications can achieve this, when needed, viadynamic configuration, as outlined above.

In other words, this specification need not define yet anotherdependency-management mechanism. Maven, Ivy, and Gradle have all tackledthis difficult problem. We should leave it to these and other buildtools, and container applications, to discover and select a set ofcandidate modules for a given library or application. The module systemneed only validate that the set of selected modules satisfies eachmodule’s dependences.


[8]ページ先頭

©2009-2025 Movatter.jp