Proposal: #VersionsInModuleNames

Mark Reinhold mark.reinhold at oracle.com
Mon Sep 12 15:11:01 UTC 2016


Issue summary
-------------
 #VersionsInModuleNames --- Some have argued that library maintainers
 will be tempted to encode major version numbers, or even full version
 numbers, in module names. Is there some way we can guide people away
 from doing that? [1]
Proposal
--------
Make two small changes:
 - Revise the automatic-module naming algorithm implemented by `javac`
 at compile time and the `ModuleFinder::of` method [2] at run time.
 It will now strip any trailing digits and period characters that
 remain after removing the version component, if any, from the name
 of the original JAR file. Thus `foo-bar-1.2.3.jar` becomes the
 automatic module named `foo.bar` with the version string `1.2.3`,
 and `foo-bar42.jar` becomes the automatic module named `foo.bar`
 with no version string.
 - Revise `javac` to emit a lint warning, enabled by default, when a
 module-declaration compilation unit mentions a module name that
 ends with one or more digit characters, whether it is the name of
 the module being declared or the name of a module referenced in a
 `requires` directive or a qualified `exports` directive.
[1] http://openjdk.java.net/projects/jigsaw/spec/issues/#VersionsInModuleNames
[2] http://download.java.net/java/jigsaw/docs/api/java/lang/module/ModuleFinder.html#of-java.nio.file.Path...-


More information about the jpms-spec-experts mailing list

AltStyle によって変換されたページ (->オリジナル) /