Skip to content

Enabling Java Platform Module System#23

Open
svanteschubert wants to merge 5 commits intomainfrom
modularization
Open

Enabling Java Platform Module System#23
svanteschubert wants to merge 5 commits intomainfrom
modularization

Conversation

@svanteschubert
Copy link
Copy Markdown
Collaborator

Java Platform Module System (JPMS)

After raising the Java baseline to JDK 11, we can support the Java Platform Module System (JPMS) using module-info.java
MSV is being brought in line with the Java Platform Module System, so published JARs have explicit module names, dependencies (requires), and API surfaces (exports). That makes the library easier to use on the module path, clarifies boundaries between artefacts, and avoids “everything on the unnamed module/classpath” ambiguity.

Package moves (RNG + TREX converters)

Earlier, the same packages existed in different modules.
JPMS does not allow split packages (the same package in two modules).
The RNG CLI lived under com.sun.msv.writer.relaxng and TypedString under com.sun.msv.grammar.trex, which overlap with msv-core. Renaming those types to converter-specific packages (com.sun.msv.rngconverter, com.sun.msv.trexconverter.datatype) is the standard fix, so each package is owned by one module, and the build stays valid.

Explicit xercesImpl on some modules

xsdlib no longer pulls in Xerces as a transitive dependency where it isn’t needed.
Modules that actually call Xerces APIs must declare xercesImpl directly.

- Add module descriptors for xsdlib, MSV core, and generator
- Adjust root POM (Surefire, compiler useModulePath) and xsdlib/generator POM dependencies
xsdlib no longer depends on Xerces; consumers that call Xerces APIs need a direct dependency.
- Avoid JPMS split package with msv-core (com.sun.msv.grammar.trex)
- Add net.java.dev.msv.trexconverter module descriptor
- Drop obsolete TypedString import from TREXWriter
…module-info

- Avoid JPMS split package with msv-core (com.sun.msv.writer.relaxng)
- Add net.java.dev.msv.rngconverter module descriptor
- Relocate message bundles and tests to the new package
- Update assembly mainClass and RELAXNGConverter entrypoint
@@ -29,7 +29,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package com.sun.msv.writer.relaxng;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not opposed to this change, but I'm curious about the reasoning behind?

@@ -1,13 +1,13 @@
/*
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In git it is always advisable to do moves in two separate commits:

  1. First a commit where the file is moved to the new name/location verbatim, so that git sees the same hash moving to a new location
  2. Then a new commit where stuff is changed (e.g. package name matching the new location)

If one follows the practice of using two commits for moves, then merges and rebases of branches using the old names will automagically find the new location/file name.

(Also, just looking at hashes and comparing them is a lot cheaper and thus faster than having to diff the files at each location)

Comment thread pom.xml
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.3</version>
<exclusions>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@steinarb
Copy link
Copy Markdown

@svanteschubert LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants