Partial module builds create unusable modules

Jonathan Gibbons jonathan.gibbons at oracle.com
Sun Aug 16 22:20:57 UTC 2020


On 8/16/20 8:03 AM, Florian Weimer wrote:
> When using --module-source-path, the compiler picks up dependencies
> along the module search path and rebuilds missing classes, for modules
> not listed under --module.
>
> Unfortunately, that can produce modules that cannot even be discovered
> at run time.  One case I encountered is when the module exports a
> package, but the modules listed under --module do not reference any
> classes in the package.  As a result, the package is not part of the
> partial build, and the module cannot be discovered because it is
> deemed malformed: “java.lang.module.InvalidModuleDescriptorException:
> Package … not found in module”, followed by
> “java.lang.module.FindException: Error reading module: …”.
>
> Is this is the expected behavior?  I can see why things are the way
> they are, but it's still a bit confusing.
>
> Sorry if my terminology is a bit off; I'm new to this stuff.
It's not the defined, expected behavior.  Agreed it is confusing.
That being said, javac has always had issues when compiling
additional classes, but this does seem to be a more egregious
case of doing something bad as a result.

-- Jon



More information about the compiler-dev mailing list