switch
语句或 switch
表达式的标记规则。
示例:
String s = switch (n) {
case 1 -> { yield Integer.toString(n); }
default -> "default";
};
在应用快速修复后:
String s = switch (n) {
case 1 -> Integer.toString(n);
default -> "default";
};
仅当项目或模块的语言级别为 14 或更高时才报告此检查。
2019.1 的新功能