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

Method parameter with many annotations gets unintuitive indentation

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
java
領域
tooling

調査の方向性

まず、issue に示されている Java の再現コードをフォーマットし、実際のインデントと期待されるインデントを比較します。メソッドパラメーターとアノテーションを担当する formatter のエントリーポイントを追跡します。すべてのアノテーションとパラメーターが同じインデントになり、この例を対象とするリグレッションテストがある状態を完了とします。

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

説明

The first annotation is indented as expected, but any additional annotations and the method parameter itself get an additional indent. I'd expect all lines to have the same indentation.

To reproduce, format:

import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.web.bind.annotation.RequestParam;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import java.util.Locale;

class Test {

    void foo(@NotNull @Parameter(name = "Indicates the language of the label to search", required = true) @Valid @RequestParam(value = "language", required = true) Locale language) {}
}

Actual (using the native executable built from 61eabd62d6a461c27621ebc77240345e40fb60b4):

import io.swagger.v3.oas.annotations.Parameter;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import java.util.Locale;
import org.springframework.web.bind.annotation.RequestParam;

class Test {

  void foo(
      @NotNull
          @Parameter(name = "Indicates the language of the label to search", required = true)
          @Valid
          @RequestParam(value = "language", required = true)
          Locale language) {}
}

Expected:

import io.swagger.v3.oas.annotations.Parameter;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import java.util.Locale;
import org.springframework.web.bind.annotation.RequestParam;

class Test {

  void foo(
      @NotNull
      @Parameter(name = "Indicates the language of the label to search", required = true)
      @Valid
      @RequestParam(value = "language", required = true)
      Locale language) {}
}
主要言語
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 を短くまとめたダイジェスト。