Skip to content
Tim Molter edited this page Apr 15, 2017 · 8 revisions

In 2014, a vote was held to determine what the general preference was regarding the code format of XChange. After determining what code format to go with the second challenge was to create compatible code formatting profiles for the different IDEs.

The resulting formatting profiles for the different IDEs can be found in xchange-parent/etc.

If you would like to contribute a format profile for an IDE not yet available, it would be greatly appreciated. If you find any inconsistencies, please either mention them in the above referenced issue or submit a patch to the formatting profile directly.

The main code formatting aspects are as follows:

Style Value
Indentation 2 spaces
Max empty lines 1
Line after method declaration minimum of zero
import ordering static, java, javax, org, com, other
import spacing spaces between import groups
line length 150 columns
line breaks Unix (\n)
Continuation indent 4
Import in same package to collapse import statement 99

Instructions

IntelliJ IDEA

In Idea, set formatter in Preferences - > Editor -> Code Style - > Java to XChange_Idea_2017_04.xml.