Partial module builds create unusable modules

Florian Weimer fw at
Tue Aug 18 07:29:29 UTC 2020

* Jonathan Gibbons:

> 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.

> 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.

Maybe for modular builds, it would be possible not to do any partial
rebuilds at all?

I guess it would also help to solve the issue of of classes lingering
behind whose sources have been deleted (because javac would have a
complete view of the expected module content).

More information about the compiler-dev mailing list