Stephan Herrmann <stephan.herrmann@xxxxxxxxx> To:
Cross project issues
05.10.2017 23:10 Subject:
Eclipse plug-ins as automatic modules in Java
9? Sent by:
I just noticed by chance that none of the artifacts we are producing are consumable as "automatic modules" in Java 9 speak.
The reason is: JPMS defines an algorithm how names for automatic modules are derived from the jar file name. Unfortunately, the spec expects any version to be separated from the name by "-", whereas our files
As a result a jar file like org.eclipse.equinox.common_3.9.0.v20170207.jar is interpreted as an automatic module named org.eclipse.equinox.common.3.9.0.v20170207 (cutting off the version fails, then "_" is converted to ".").
Since that module name is not a legal Java identifier, the given jar file cannot be referenced in any "requires" clause of a Java 9 module.
While all this is very unfortunate, Java 9 provides a means for a systematic solution: adding an Automatic-Module-Name header to MANIFEST.MF.
Hence, I propose to make this a rule for future releases that all bundles should have this manifest header, where the value should be identical to the value of Bundle-SymbolicName.
There may not yet be any consumers of Eclipse plug-ins as Java 9 modules, but as we know that several of our artifacts are being consumed outside
OSGi, I am sure that clients will expect our artifacts to be consumable as Java
9 modules sooner or later. And then a general solution looks cleaner to me then doing this for selected artifacts only.