We've seen cases in the Jenkins project use of spotless formatting where a comment adjacent to a case statement inside a switch will be formatted on Java 17 with a different indentation than on Java 21, even though the Java version is declared as Java 17 in the Maven project using Spotless.
A recent example is:
When we move the comment so that it is either inside the case or outside the switch, then the Java version dependent formatting does not happen.