Java modifier sort order
Answered
An IntelliJ Java inspection considers the following modifiers as missorted:
private static abstract
It wants to reorder them as:
private abstract static
I much prefer the order that I used. Is there any way to change the preferred modifier order?
Please sign in to leave a comment.
Hello,
The "Missorted modifiers" inspection follows the order as specified in the Java Language Specification. In chapter 8 paragraph 1.1 the order of modifiers for classes is listed as
public protected private abstract static final strictfp
. The "private abstract static" order is also confirmed by the OpenJDK guidelines.You can only disable this inspection, but not to change the predefined order.