[module-imports] Importing java.se?

Tagir Valeev amaembo at gmail.com
Wed Jul 17 07:32:32 UTC 2024


Hello!

Thank you for the answer



On Wed, Jul 17, 2024 at 2:06 AM Alex Buckley <alex.buckley at oracle.com>
wrote:

>
> This is technically true, but it's missing the forest for the trees. The
> compilation unit that contains your implicitly declared class *already*
> has `import module java.base` at the top, per JEP 477. (And java.base is
> certainly in the default set of root modules for the unnamed module.) I
> think the trouble with java.se has led javac to forget that java.base
> (and hence ArrayList) is imported.
>

In my sample, implicit class is not used. I think, at some point, beginners
move away from implicit classes,
and the question still remains, whether it's a reasonable idea to use
`import module java.se`, or not.
I find it strange that to import the whole Java SE API, one need to add two
explicit imports (java.se and java.base)
when not using implicit class.

With best regards,
Tagir Valeev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-spec-experts/attachments/20240717/3e205f39/attachment.htm>


More information about the amber-spec-experts mailing list