As discussed earlier, the core of Vaadin 8 is already compatible with Java 9. The issue burdening developers, however, has been the incompatibility of GWT when compiling a new widgetset, or developing new components. For many Vaadin developers, this has been a showstopper, as setting up a different JDK to compile the widgetset would have been too much work.
Now GWT has a rudimentary JDK 9 compatibility
Finally, there is a release of GWT that supports compiling with JDK 9. The maintenance release doesn't yet support language features introduced with Java 9, but at least you can now compile GWT Java 8 code with JDK 9. Even though we originally planned to ship a better Java 9 support in 8.2 release, we also rushed to push out a maintenance release of Vaadin Framework (8.1.6). This version now depends on the latest GWT version and fixed an add-on related issue in the Maven plugin. Now you can compile your custom Vaadin widgetset without issues.
So go ahead and update to the latest and greatest Java release and enjoy the new features. Just notice that if you happen to be working with client-side code, like custom GWT widgets, you’ll need to stick with Java 8 compatible APIs on that part of the project.
OpenJDK 9 is still an issue
Even though the differences between OpenJDK and Oracle JDK are nowadays minimal, there still appears to be some issue with OpenJDK 9 and widgetset compilation. Thus, we recommend that you as a Vaadin developer stick with the official Oracle JDK.
We are trying to find out what is the cause of the issue and to find a workaround. Follow the issue #10257, if you are eager to move to OpenJDK and wish to follow the progress, or even help resolve the issue.
Possibilities for more advanced Java 9 support
Although essential Java 9 support is now in, there are still certain things we could improve.
Using less built-in JDK modules could open possibilities to streamline the JRE used to run the Vaadin application. The sweet spot is getting rid of the JavaBeans Introspector dependency, which again depends on many desktop related modules. Dropping desktop related modules would mean a much smaller runtime environment.
Making all Vaadin artifacts proper Java 9 modules is, of course, one of the goals. But it is also a huge task and probably can’t be achieved without dropping support for Java 8, so it is not going to happen any time soon. Before going there, there is a shortcut that could make some things possible without full module support. We could add hints for JDK 9 about the automatically created names that it uses, in case a Vaadin app runs using the Java 9 module path. This could avoid collisions with, for example, our “shared” package and many other “shared” packages. To follow the progress of this, star issue #10132 in GitHub. This enhancement might fit into the soon to be released 8.2 release.
Improving GWT support for Java 9 language features would open up using some language improvements on the client side GWT development, as well. As this is a relatively large change and Vaadin is moving towards a Web Component based client-side, we won’t be investing into this. But in case somebody else from the GWT project decides to implement full Java 9 support for GWT, we’ll for sure update Vaadin to use this new version.
Do you have any other ideas of how to get the most out of Java 9? Please share your insights!