JPMS Module Path question

Peter Kriens peter.kriens at
Wed Jun 14 12:59:58 UTC 2017

I am trying to formally specify JPMS using Alloy. One of the questions that is popping up is about the consistency of the Module Path.

The Module Path is defined as a set of directories (and files?) containing modules. Duplicate names seem to be disallowed in one directory but allowed between directories (and files?), where the first one wins. (Though useful for overrides, it is a rather error prone solution as we learned from the linear search of the class path). 

However, I cannot seem to find consensus on the consistency of modules in this module path. Must the set of available modules on the module path be consistent or is there no relation between these modules. For example, can these modules contain the same package?

That is, is the module path a giant repository and will a resolution pick out the needed modules and verify this subset for consistency, or is it supposed to be a subset optimised for an application?

For example:

	dir-x: A { exports a, requires B }
	dir-x: B { exports b }
	dir-x: C { requires A,D }
	dir-y: D { contains a, b }
	dir-y: A { exports a, b }

Loading A would be ok but loading C would fail. Is it intended that you can have potentially inconsistent modules?

Some issues:

* Since modules lack versions a repository seems infeasible
* JPMS must read a module from disk, even if it does not use it, an inconsistent module path would require a different reader then a consistent module path. For a consistent module path each package can have one module but and inconsistent module path a package can have multiple providers

I would highly appreciate an answer from this forum. 

Kind regards,

	Peter Kriens

More information about the jpms-spec-observers mailing list