Draft Spec for Preview of Module Import Declarations (JEP 476)
Alex Buckley
alex.buckley at oracle.com
Fri Apr 26 16:34:22 UTC 2024
A few small things:
- 7.5 says "A single-module-import declaration (7.5.5) imports all the
accessible classes and interfaces, as needed, from every package
exported by a given module." The "every package" makes me a little
nervous because there might be qualified exports which are not
importable by the s-m-i declaration. That is, we don't want 7.5 to
conflict with 7.5.5's "The packages exported by the module M ***to the
current module.***" Recommend: "A single-module-import declaration
(7.5.5) imports all the accessible classes and interfaces of the
packages exported by a given module, as needed." Unlike the preceding
four bullets, we don't mention the canonical name of the module, because
at present modules don't have canonical names; that's probably still OK.
- Example 7.5.5-1 mentions "All simple compilation units implicitly
import the module java.base (7.3)." which should be a normative
statement, not an informative one. (I'm sure it will move/relate to a
new section on Simple Compilation Units in future, but for now we
shouldn't lose it in an example.)
- I recommend having Example 7.5.5-1 be "Single-Module-Import in
Ordinary Compilation Units", forking off Example 7.5.5-2
"Single-Module-Import in Modular Compilation Units" at "Import
declarations can also appear in a modular compilation unit." Eventually
there will be an Example of "S-M-I in Simple Compilation Units".
Alex
On 4/26/2024 3:07 AM, Gavin Bierman wrote:
> 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