no error when module exports non-existing package

Jonathan Gibbons jonathan.gibbons at
Wed Dec 2 18:09:44 UTC 2015

Adding Victor back into the recipients.

-- Jon

On 12/02/2015 10:08 AM, Jonathan Gibbons wrote:
> On 12/02/2015 09:41 AM, Victor Rudometov wrote:
>> Hi,
>> Javac does not complain if user exports a package that does not 
>> exist. If it was not done intentionally, it would be good to report 
>> an error, or at least a warning.
>> Today was the third time I saw the code with a typo or just incorrect 
>> package name in module-info's exports statement.
>> Thanks.
>> Victor.
> I agree we should improve javac in this area. We probably need some 
> spec clarification from Alex on the intent here. See JLS 8, 7.4.3 
> Observability of a package.  In particular, that says that a package 
> is observable if a subpackage is observable.  javac tries to honor 
> that specification, but there are well known hard-to-fix bugs in this 
> area.
> As for module declarations,   if  p.q.Class exists in a module and no 
> other classes anywhere in p or its subpackages, is it OK to export p 
> from the module?  From the point of view of the module, the package is 
> observable, but it seems intuitively wrong to allow an export of a 
> package that contains no types.  In other words, if we are going to 
> catch typos in exported package names, I think we ought to consider 
> "empty" packages as well as mistyped packages.
> -- Jon

More information about the jigsaw-dev mailing list