Closed
Description
Placing single-line or block comments before case statements in an enhanced switch causes them to be indented. This seems to be in violation of 4.8.6.1 Block comment style.
Auto-formatted code:
public class T {
public static void main(String[] args) {
int a = 1;
switch (a) {
case 1 -> System.out.println("1");
// This is a comment before a case statement
case 2 -> System.out.println("2");
/*
* Block comment before a case stement
*/
case 3 -> System.out.println("3");
// Comment before the default statement
default -> System.out.println("N/A");
}
}
}
Metadata
Metadata
Assignees
Labels
No labels