Has it been considered to apply the export modifier to the package-info.java?

Stephane Epardaud stef at epardaud.fr
Tue Oct 6 12:39:07 UTC 2015


On 05/10/15 20:54, mark.reinhold at oracle.com wrote:
> 2015/9/28 9:57 -0700, peter.kriens at aqute.biz:
>> The current proposal places the export in a module-info file. It would
>> be much more convenient to place this as a modifier on the
>> package-info.java.
>>
>> 	public package com.foo;
> Why would this be more convenient?
>
> Placing all of the export clauses in the module descriptor makes it easy
> to see, by reading just one file, exactly what a module is exposing to
> the outside world.  Sprinkling them across package-info.{java,class}
> files makes that much more difficult.
FTR this is what we do in Ceylon, where every package is private by
default, unless there is a package descriptor marked "public". It's more
regular since it works like for classes which are also private by
default unless marked "public". You don't list public classes in the
package descriptor, even though that makes them easier to see, like your
argument for packages and modules.

That being said, regularity is not all there is, and I have to agree
that it's not a bad idea to list public packages in the module
descriptor. There are advantages to either choice and TBH I don't find
either to be better/worse overall (and this comes from someone used
already for a while to describe public packages in modules).



More information about the jpms-spec-observers mailing list