JEP-476 module import considered harmful

Ron Pressler ron.pressler at oracle.com
Tue Nov 19 13:39:29 UTC 2024


Hi.

Merely stating that you you believe some feature to be harmful is not helpful feedback, because we already take it as a given that there are many features that some people strongly believe are very useful while others believe just as strongly to be harmful. Such a statement provides no actionable information.

What could be helpful is trying to precisely articulate a problem you’ve run into. For example, if a file has `import module a; import module b;` and it uses the type `X`, you would need to search both `a` and `b` to find the documentation for `X` when reading the code, rather than just one of them (if we had, say, import X from module a`). Is that the problem you’re referring to? Why does it make reading the code so much more difficult for you?

— Ron

> On 19 Nov 2024, at 09:49, Cristian Mocanu <cvmocanu at gmail.com> wrote:
> 
> Hello,
> 
> My name is Cristia Mocanu, and I am a Java developer with almost 20 years of experience.
> 
> I was made aware of "JEP-476 module import" recently.
> 
> I strongly recommend making sure this JEP is abandoned and never gets merged into Java.
> The reason is that a module import shares the same problem with the star import: it makes the code much more difficult to understand without an IDE (e.g. when reviewing a PR on GitHub).
> The problem with the star import is so bad, that many official code styles, and many teams I worked in, explicitly forbid star imports, making the build fail if one is found (i.e. by using Checkstyle's AvoidStarImport rule).
> 
> The module import, just like the star import, will have the very bad effect of encouraging people to write code that is difficult to understand.
> The advantage would be that the VIM guy can type less when writing a Java file. Don't get me wrong, I use VIM myself (even the IdeaVim plugin), but the last time I wrote an import manually was probably 15 years ago - in the real world, we type the class name, and IntelliJ or some other IDE writes the import for us.
> 
> With fewer words: this JEP has nasty disadvantages, without providing any real world benefit.
> 
> Kind regards,
> Cristian



More information about the amber-dev mailing list