modulepath and classpath mixture

Russell Gold russell.gold at oracle.com
Thu Mar 24 03:37:11 UTC 2016


> On Mar 23, 2016, at 11:42 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> 
> 
> 
> On 23/03/2016 14:15, Russell Gold wrote:
>> Here are my assumptions, which you can correct.
>> 
>> 1. A jar or classes directory placed on a class path are treated as part of the unnamed module
> Yes

Then it seems to me that there isn’t actually a problem, here. Build tools can continue to work unchanged, using class paths to allow unit tests to access the code they are testing. The jars are then treated as modules by other builds, which shouldn’t be accessing the module internals in any case. If they really do need to access them, they just put those jars on their class paths - but that’s a hint of poor modularity and testability.

> 
>> 2. A jar containing a module-info file is treated as a module when placed on a module path, and restricts access to non-exported packages
> It also declares what it depends on and maybe services that it uses/provides.
> 
> Also a JAR file on the module path without a module-info.class is treated as an automatic module.

And what is an automatic module? I didn’t see that in the specs
> 
> 
>> 3. A jmod file is only usable on the module path.
> JMOD files are unlikely to be seen by most developers. They are not an executable format. They are mostly for link-time when creating a custom run-time image.
> 
> 
>> 
>> If a class directory or a jar function as modules when placed on the class path, what is the point of a separate module path? And even in that case, doesn’t it make sense to treat a class directory as part of the unnamed module in general? That makes this problem go away completely. It doesn’t provide access to third parties, as code would not be distributed as loose classes.
>> 
> You would loose the benefits of the module path and I assume couldn't distinguish automatic modules from regular JAR files. In general I would think this would be just confusing and I don't know what problem it would solve.

It doesn’t, because it was based on my assumptions being wrong :)

I was trying to understand the problems Robert and Stephen were raising - and I cannot see the issue. 

- Russ


More information about the jigsaw-dev mailing list