Draft Spec for Preview of Module Import Declarations (JEP 476)
Stephan Herrmann
stephan.herrmann at berlin.de
Sat May 18 13:33:34 UTC 2024
Hi Gavin,
I'm having difficulties interpreting this example:
import module M;
module M {
...
uses C;
...
}
Literal interpretation would suggest that this imports
"all the public top level classes and interfaces in the following packages:
* The packages exported by the module M to module M. ..."
The notion of exporting to self does not seem to be defined, is it?
JLS 7 says: "A module categorizes some or all of its packages as exported, which
means their classes and interfaces may be accessed from code outside the
module." i.e., export regulates accessibility across a module boundary, but in
the above example there is no such boundary.
Should the module import still be limited to exported packages? But then:
exported to whom? Would a qualified export to some other module M2 hide that
package from the module M itself (wrt the module import)?
At least the requirement that M is read by M is satisfied, according to a
comment in JLS 7.3.
thanks,
Stephan
Am 26.04.24 um 12:07 schrieb Gavin Bierman:
> Dear experts:
>
> The first draft of a spec covering JEP 476 (Module Import Declarations (Preview))
>
> https://cr.openjdk.org/~gbierman/jep476/latest/
> <https://cr.openjdk.org/~gbierman/jep476/latest/>
>
> Feel free to contact me directly or on this list with any comments.
>
> Thanks
> Gavin
>
>> On 17 Apr 2024, at 19:58, Mark Reinhold <mark.reinhold at oracle.com> wrote:
>>
>> https://openjdk.org/jeps/476
>>
>> Summary: Enhance the Java programming language with the ability to
>> succinctly import all of the packages exported by a module. This
>> simplifies the reuse of modular libraries, but does not require the
>> importing code to be in a module itself. This is a preview language
>> feature.
>>
>> - Mark
More information about the amber-spec-experts
mailing list