Java 9: Memorize package or module names again? Really?


For Java 8 (and earlier) I am totally used to IDEA handling all my imports for me. I just never write any import statement manually.

Usually I just type something like "Connection c" and let IDEA add "import java.sql.Connection".

Now I am playing with Java 9 and IDEA and I am very surprised and somewhat disappointed:

Do I really have to either

  • manually add the import statement myself (after having memorized or looked up the correct package name) and then while on the "import" statement use the IDEA inspection to add the "requires java.sql;" to the
  • manually navigate to the, add the "requires java.sql;" there (after having memorized or looked up the correct module name), switch back to my class and then let IDEA add the import statement.

Surely, there must be an easier way that lets me add both the "requires" and the "import" in one step??

For example when (with JDK 8) I write a class name that IDEA find in _any_ library, I get an intention to "Add library foo to classpath" and after that IDEA has added both the library dependency as well as the import statement.

Currently this feels a bit like using a text editor again to program in Java (which I haven't done for decades).

1 comment
Comment actions Permalink

Similar features should be supported in IDEA 2018.


Please sign in to leave a comment.