You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[plugin-maven] eclipse formatter sorts Java class members and imports lexicographically rather than alphabetically #2493
Contrary to the formatter within the Eclipse IDE (which sorts Java class members and imports alphabetically), the eclipse formatter within Spotless sorts Java class members and imports lexicographically (!?!) — here it is my configuration:
<eclipse>
<file>${project.basedir}/config/eclipse/java-style.xml</file>
<sortMembersEnabled>true</sortMembersEnabled>
<!-- Optional: Specify the sort order of the member categories. (default: T,SF,SI,SM,F,I,C,M) SF,SI,SM,F,I,C,M,T = Static Fields, Static Initializers, Static Methods, Fields, Initializers, Constructors, Methods, (Nested) Types -->
<sortMembersOrder>T,SF,SI,SM,F,I,C,M</sortMembersOrder>
<sortMembersVisibilityOrderEnabled>true</sortMembersVisibilityOrderEnabled>
<!-- Optional: Specify the ordering of members of the same category by the visibility within the category (default: B,V,R,D). B,R,D,V = Public, Protected, Package, Private -->
<sortMembersVisibilityOrder>B,R,D,V</sortMembersVisibilityOrder>
</eclipse>
Feeding Eclipse IDE-formatted source code to spotless-maven-plugin, the resulting source code differs just in its sorting — for example:
changed the title [-][plugin-maven] `eclipse` formatter sorts members lexicographically rather than alphabetically[/-][+][plugin-maven] `eclipse` formatter sorts Java class members lexicographically rather than alphabetically[/+]on May 28, 2025
changed the title [-][plugin-maven] `eclipse` formatter sorts Java class members lexicographically rather than alphabetically[/-][+][plugin-maven] `eclipse` formatter sorts Java class members and imports lexicographically rather than alphabetically[/+]on May 28, 2025
Activity
[-][plugin-maven] `eclipse` formatter sorts members lexicographically rather than alphabetically[/-][+][plugin-maven] `eclipse` formatter sorts Java class members lexicographically rather than alphabetically[/+][-][plugin-maven] `eclipse` formatter sorts Java class members lexicographically rather than alphabetically[/-][+][plugin-maven] `eclipse` formatter sorts Java class members and imports lexicographically rather than alphabetically[/+]aKandzior commentedon May 8, 2026
I commited a pull request to fix this issue, see: Use Collator when sorting Eclipse JDT members
stechio commentedon May 20, 2026
Its release version (3.5.1) worked nicely, thank you @aKandzior!