Support JEP 512: Compact Source Files and Instance Main Methods
まだ誰も着手していません。
評価
調査の方向性
まず、報告された learn/jbang/hello.java の例を使って v1.25.1 の失敗を再現し、JEP 445、463、477、495 を確認します。コンパクトなソースファイルとインスタンス main メソッドに必要な formatter の変更を特定し、その後、「did not generate token」エラーなしで例が正常にフォーマットされることを検証します。
索引モデルが issue の本文から書いたものです。
説明
In https://github.com/enola-dev/enola/pull/974 for https://github.com/enola-dev/enola/issues/971 with https://github.com/enola-dev/enola/issues/970, I am using "Java's fancy modern main style", AKA the JEP 445 & 463 & 477 & 495 stuff:
- https://openjdk.org/jeps/445
- https://openjdk.org/jeps/463
- https://openjdk.org/jeps/477
- https://openjdk.org/jeps/495
So I have e.g. a hello.java which looks e.g. like this, which is actually valid (with --enable-preview) Java 21 syntax:
import static java.lang.System.out;
void main() {
out.println("Hello World: " + dev.enola.common.Version.get());
}
google-java-format chokes on this with:
stderr: learn/jbang/hello.java:26:6: error: did not generate token "void"
void main() {
This is on v1.25.1, which is the 2nd most recent release today; looking at the 1.25.2 Release Notes, I have no reason to believe that this (just) got fixed there; ergo reporting this here.
Stating that google-java-format does not support --enable-preview would be valid. But from what little I figured (so far) this feature, contrary to e.g. those preview String Templates which then got removed again, this syntax appears to be here to stay, so probably should be supported, sooner or later.
- 主要言語
- Java
- スター
- 6.2k
- フォーク
- 936
- 平均マージ
- 6分
- マージ済み PR(30日)
- 3
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
google/google-java-format のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
google/google-java-format#1094 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
google/google-java-format#1450 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
google/google-java-format#1439 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 62/100
google/google-java-format#1436 · コメント 2 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
google/google-java-format#1428 · コメント 3 件 ·
google/google-java-format の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
elastic/gradle-plugins#157 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
cryptomator/hub#497 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
johanhaleby/occurrent#1120 ·