Use the latest (neon) version of the formatter with mars

 

If you are using the Mars Version of the Eclipse IDE you have probably noticed the new java formatter. The new formatter solves a lot of bugs (some of them were open since a long time in Bugzilla, see Bug 303519 for a long version of the story) but as with any piece of new software, it also comes with some new ones.

A lot of bugs have already been fixed on the master branch and backported to be available with the Mars.1 release. In our company, we have already updated our IDE distribution in order to benefit from the latest fixes.

Fixing bugs is an ongoing process and we continue to see additional bugfixes on the master branch (where the Neon version of Eclipse is developed). Updating to a nightly, weekly or milestone release of the Neon version isn’t something we want to do now for all our coworkers. So we stay with Mars, but the next Mars release will only be available in February 2016 and we still would like to profit from backported bug fixes before. What to do?

We have figured out a way to take advantage of the fixes now instead of waiting until the next release. Based on the approach described by Mateusz Matela it is possible to put the latest version of the formatter (code taken on the master branch of the JDT project) in a Plugin you can use today with your Mars IDE. Our first tests with the plugin show that the fixes are working well for us. If you have similar needs you can find the plugin I have prepared on GitHub and install it from BinTray using this update site:

 

https://dl.bintray.com/jmini/java-formatter/
Datum