Automatic module names

Ali Ebrahimi ali.ebrahimi1781 at gmail.com
Sat Feb 4 08:13:01 UTC 2017


Hi,
The name clash problems can be easily resolved with an optional module
group property for modules As same thing we currently have for classes: FQN
class = pkg name + class simple name
The same mechanism can work for modules. FQN module = group name + module
simple name
This solution very nicely fits with maven repository layout and can avoid
name clash problems.

The group name as with package name is optional for modules.

module java:java.base{  //group name = java

}

module jdk:jdk.jlink{ //group name = jdk

}

...


module stax <https://mvnrepository.com/artifact/stax>:stax
<https://mvnrepository.com/artifact/stax/stax>{ //group name = stax
<https://mvnrepository.com/artifact/stax>
...
}

module codehaus-stax: <https://mvnrepository.com/artifact/codehaus-stax>stax
<https://mvnrepository.com/artifact/codehaus-stax/stax>{ //group name =
codehaus-stax <https://mvnrepository.com/artifact/codehaus-stax>
...
}


module m1{
      requires stax <https://mvnrepository.com/artifact/stax>:stax;
<https://mvnrepository.com/artifact/stax/stax>
}

module m2{
      requires codehaus-stax:
<https://mvnrepository.com/artifact/codehaus-stax>stax
<https://mvnrepository.com/artifact/codehaus-stax/stax>;
}

module path layout:

$module_path_root/codehaus-stax/stax-1.1.1.jar
$module_path_root/stax/stax-1.2.0.jar
$module_path_root/m1-1.0.jar
$module_path_root/m2-1.0.jar
...

(Assuming m1 and m2 valid module names)

The format for module path entries is as: [group/]module-*.jar;....

 What do you think?
Module groups can help wrt overlapping package modules problem.



On Fri, Feb 3, 2017 at 9:12 PM, Alan Bateman <Alan.Bateman at oracle.com>
wrote:

> On 03/02/2017 16:42, David M. Lloyd wrote:
>
> :
>>
>> Sure, but the set of JARs you can't rewrite is really pretty spare.
>>
>
> I've no doubt that many people would be uncomfortable taking
> responsibility to modularize a component that they don't maintain or have
> full knowledge of. In the early exploration phase of Project Jigsaw then we
> have some basic tooling to help with exactly that approach but it has long
> been left behind. One reason is that potential for anarchy with several
> people converting the same library to a module. You might not like
> automatic modules but at least the module descriptors that are derived are
> very predictable (including the name).
>
> -Alan.
>



-- 

Best Regards,
Ali Ebrahimi


More information about the jigsaw-dev mailing list