Friday, 23 September 2016

Java 9 module-info Files in the Eclipse IDE

It’s been a while, but I’m back to experimenting in Java 9 support in the Eclipse IDE.
For testing purposes, I downloaded the most recent Oxygen (4.7) integration build (I20160914-0800) from the Eclipse Project downloads the latest  Java 9 JRE build (135).

I configured the Eclipse IDE to run on the Java 9 JVM. This still requires a minor change in the eclipse.ini file: to launch successfully, you must add to the vmargs section (I expect this to be resolved before Java 9 support is officially released; see Bug 493761 for more information). I used and used the Install new softwar. dialog to pull in updates from the BETA_JAVA9 SDK builds repository.

I created a very simple Java application with a file. Content assist is available for this file.

Java 9 module-info Files in the Eclipse IDE

Note that there is an error indicated on the import of java.awt.Frame. This error exists because the module info file does not provide visibility to that class (AWT is not included with java.base).

If we change that requires statement, the visibility issue is resolved and the compiler is happy. Well, mostly happy. Apparently not using declared variables gets you a stern warning (this is, of course, configurable).

Java 9 module-info Files in the Eclipse IDE

The Eclipse Project is planning to ship support as part of an Eclipse Neon update release that coincides with the official release date of Java 9. I’ll be talking a bit about this during my JavaOne talk and demonstrating this (and more Java topics) at the Eclipse Foundation’s booth.