Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

regression of issue #1008 on idea-plugin

オープン
#1,271 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
java
領域
tooling

調査の方向性

リポジトリのファイルもテストも指定されていません。まず idea-plugin 1.27.0 を使って Java 21 の switch の例を再現し、そのフォーマットを CLI と比較します。プラグインが CLI と一貫して case null, default を処理し、workaround を必要としなくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

IntelliJ

Previously, when Issue #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:

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

      case null -> "null value";
      default -> "unexpected value";

A simple class to allow easy testing of this

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

主要言語
Java
スター
6.2k
フォーク
936
平均マージ
6分
マージ済み PR(30日)
3

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

google/google-java-format のほかの issue

google/google-java-format の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。