[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cross-project-issues-dev] Eclipse plug-ins as automatic modules in Java 9?
- From: Stephan Herrmann <stephan.herrmann@xxxxxxxxx>
- Date: Thu, 5 Oct 2017 23:10:34 +0200
- Delivered-to: email@example.com
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0
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 use "_".
As a result a jar file like
is interpreted as an automatic module named
(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.
Reference for naming of automatic modules: