Is it possible to have 2 modules with the exact same name (but with slightly different contents) on the module path?
As far as I can tell, the Java 9 compiler does n
JEP 261 of the module system describes the module path as follows:
A module path is a sequence, each element of which is either a module definition or a directory containing module definitions. Each module definition is either
A module artifact, i.e., a modular JAR file or a JMOD file containing a compiled module definition, or else
An exploded-module directory whose name is, by convention, the module's name and whose content is an "exploded" directory tree corresponding to a package hierarchy.
It then describes the module resolution mechanism:
When searching a module path for a module of a particular name, the module system takes the first definition of a module of that name. Version strings, if present, are ignored; if an element of a module path contains definitions of multiple modules with the same name then resolution fails and the compiler, linker, or virtual machine will report an error and exit. It is the responsibility of build tools and container applications to configure module paths so as to avoid version conflicts; it is not a goal of the module system to address the version-selection problem.
As explained, it means that the compiler will complain only if two modules with the same name exist in the same directory.