报告可以转换为代码块的 switch 表达式或增强的 switch 语句的规则。

示例:


  String message = switch (errorCode) {
    case 404 -> "Not found!";
    ...
  };

在应用快速修复后:


  String message = switch (errorCode) {
    case 404 -> {
                yield "Not found!";
            }
    ...
  };

仅当项目或模块的语言级别为 14 或更高时才报告此检查。

2019.1 的新功能