Java 9 inside IDEA IntelliJ – how is it working?
Java 9 came out and it is the most recent version of Java. It has a bunch of new features. But how is Java 9 working inside your favorite IDE? Does it have support for all Java 9 features? How good is Java 9 inside IDEA Intellij? Let’s find out!
Jigsaw & the JPMS
You can create a module-info.java file for your IntelliJ IDEA modules:
This gives you the basic module declaration structure. It also includes a module name that’s matching the name of your IDEA IntelliJ module. While in this file, the code highlighting and completion works too.
Running the code from a module with a module-info.java, the -p argument (module path) will automatically be used instead of -classpath.
Duplicate detection and common quick-fixes are also there. I mean… this IS IDEA IntelliJ, right? 😉
Modules diagrams are also possible, which makes you visualize your modules structute easily.
Also, Java 9 code inspection is pretty cool feature too.
Convenience Factory Methods
Lots of small API changes in Java 9 were introduced. They make developer’s life much easier. Creation of Collections with fixed contents is one of them. There is an inspection in IDEA IntelliJ for that.
You can use Thread.onSpinWait to let Java Runtime know if your code is going through an loop (spinning in loop) while waiting for something to happen. IDEA IntelliJ will locate where this hint might be useful in the code and give you an opportunity to add it.
This enhances the usage of @Deprecated annotation in Java. This new inspection in IDEA IntelliJ can highlight any use of code that has been marked “forRemoval”.
JShell is a REPL for Java. Ti is, of course, introduced in Java 9. IDEA IntelliJ has a console that allows you to work with JSchell from inside IDEA IntelliJ terminal.
Other Java 9 specific features
There are a lot of other Java 9 features. They don’t require any special adjustments for IDEA IntelliJ. That means that everything runs smooth regarding Java 9 inside IDEA IntelliJ.
Is Java 9 supported in IDEA IntelliJ? Yes!
To find out more visit IDEA IntelliJ blog.