Skip to content

Spotless formats code differently between JDK versions (17 vs 21) #2503

@MarkEWaite

Description

@MarkEWaite

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions