Spotless formats code differently between JDK versions (11 vs 17 and above)

Discover and leave spotless issues while contributing apache-seata to the project.

background is:

  • palantirJavaFormat needs to be upgraded to version 2.71.0 or later for jdk 25 support.

There is a difference between how Java 11 handles switch statement annotations and how Java 17 and later versions handle switch statement annotations.

A recent example is :

How do I set up spotless to support JDK Java 11 Java 17 and later versions?