Skip to content

Commit

Permalink
Suppress WhitespaceAround for switch case body
Browse files Browse the repository at this point in the history
This allows empty bodies in enhanced switch statements:

    switch (x) {
        case 1 -> System.out.println("one");
        case 2 -> System.out.println("two");
        default -> {}
    }
  • Loading branch information
martint committed Aug 12, 2023
1 parent 255b165 commit 8d6dd2b
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@
<property name="sortStaticImportsAlphabetically" value="true" />
</module>

<module name="SuppressionXpathSingleFilter">
<property name="checks" value="WhitespaceAround"/>
<property name="query" value="//LITERAL_SWITCH//SLIST"/>
</module>
<module name="SuppressionXpathSingleFilter">
<property name="checks" value="WhitespaceAround"/>
<property name="query" value="//LITERAL_SWITCH//RCURLY"/>
</module>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true" />
<property name="allowEmptyMethods" value="true" />
Expand Down

0 comments on commit 8d6dd2b

Please sign in to comment.