google / google/google-java-format
regression of issue #1008 on idea-plugin
- 主要語言
- Java
- 星號
- 6.2k
- 分支
- 937
- 平均合併
- 6 分鐘
- 30 天內合併 PR
- 3
描述
Previously, when [Issue #1008](https://github.com/google/google-java-format/issues/1008) was reported, it was resolved.
However, with the recent update to the idea-plugin to version 1.27.0, this issue resurfaced.
This piece of code:
```java
switch (value) {
case 0 -> "it was 0";
case 1 -> "it was 1";
case 2 -> "it was 2";
case null, default -> "unexpected value";
};
```
Works fine with the CLI version of google-java-formatter, but will fail for the idea-plugin version of google-java-formatter.
The only solution is to revert the above switch pattern into
```java
case null -> "null value";
default -> "unexpected value";
```
A simple class to allow easy testing of this
```java
public class Test {
public static void main(String[] args) {
Object obj = null; // or some other object
String result = switch (obj) {
case null, default -> "handled";
};
System.out.println(result);
}
}
```
JDK Used: https://adoptium.net/en-GB/temurin/releases/?version=21
貢獻指南
研究方向
未指定任何 repository 檔案或測試。先使用 idea-plugin 1.27.0 重現 Java 21 的 switch 範例,並將其格式化結果與 CLI 進行比較;當外掛程式能夠與 CLI 一致地處理 `case null, default`,且不需要 workaround 時,即視為完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- java
- 領域
- tooling
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100