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

mark.reinhold at oracle.com mark.reinhold at oracle.com
Mon Oct 5 18:54:23 UTC 2015

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.

> Since it seems inevitable that there is a tooling step this would
> require little effort and cause no runtime overhead.

There would be some additional run-time overhead.  In order to enforce
access control a JVM would have to search for and, if found, read a
separate package-info.class file for every package in a module.  This
overhead might not be terribly significant, but it would be non-zero.

- Mark

More information about the jpms-spec-experts mailing list