commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: [all] Java 9 module names
Date Fri, 21 Apr 2017 12:59:09 GMT
On 21 April 2017 at 13:00, Stephen Colebourne <scolebourne@joda.org> wrote:
> Hi All,
> Java 9 is coming soon (unless it is delayed again, but that seems
> unlikely). The major feature is JPMS, the Java Platform Module System.
> While JPMS is far from ideal, projects like Apache Commons and mine
> Joda-* are going to be key to getting some adoption. This is
> particularly true as Commons projects tend to be at the base of the
> dependency tree.
>
> I've written up my recommendations for naming modules here:
> http://blog.joda.org/2017/04/java-se-9-jpms-module-naming.html
> Basically, it strongly recommends reverse-DNS naming based on the
> super-package of a project.
>
> What is needed now?
>
> Apache Commons, and Apache in general, needs to agree to use a
> consistent naming strategy for modules. As per my writeup, I strongly
> recommend using the super-package name as the module name, as most
> Apache projects already have good separation by package name.
>
> It will be important to ensure complete separation however, as JPMS
> does not allow the same package to be in two modules.
>
> Finally, it is important to note that modules are not the same as
> artifacts. Modules, and thus their names, represent the JVMs view of
> the structure of an application. Artifacts are a transport mechanism
> (jar file), and many different artifacts can provide the same module.
> This becomes apparent when considering the Apache branded JSR jar
> files, for example the module name might be javax.servlet (ie. not
> referencing Apache), but the artifactId is apache-jsr-360 (which does
> reference Apache).
>
>
> So, how to apply this to Commons (and Apache in general)?
>
> Well, I haven't examined each commons subproject, but from my time
> contributing years ago, each subproject has its own package name.
> Thus:
>
> Commons-IO
> -> super-package org.apache.commons.io
> -> module org.apache.commons.io
>
> Commons-Lang3
> -> super-package org.apache.commons.lang3
> -> module org.apache.commons.lang3
>
>
> If everyone agrees, the module name for each project should be
> documented somewhere on the website. Note that this should be done
> _now_, but does not require creating a module-info.java file, or
> otherwise preparing for Java 9.
>
> Comments? Questions?

What happens when there is a API break which necessitates a package name change?
I assume that the module name will also need to change to the new super-package.
e.g.

Commons-Lang4
-> super-package org.apache.commons.lang4
-> module org.apache.commons.lang4

AFAICT Commons generally has obvious and unique super-packages for
each component.
This should make it easier than for larger projects with lots of jars
and potentially overlapping package names.

However even Commons has some code that uses a different package structure.
e.g. NET uses examples as the super-package.
This includes working examples that are included in the release.
I guess that will have to change (which is probably a good idea anyway).

> thanks
> Stephen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message