IllegalAccessError from com.sun.tools.javac.util
まだ誰も着手していません。
評価
調査の方向性
RemoveUnusedImports.java:218 の失敗から始め、参照されている issue コメントと比較します。OpenJDK 17.0.10 を使用してコマンドラインまたは IntelliJ でのビルドを再現し、gradle.properties の workaround と記載されているモジュールアクセスフラグを確認します。この IllegalAccessError に対して、報告されている workaround に依存せずにビルドでエラーが発生しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Similar to https://github.com/google/google-java-format/issues/787#issuecomment-1971447073_
Caused by: java.lang.IllegalAccessError: class com.google.googlejavaformat.java.RemoveUnusedImports (in unnamed module @0x2b099be2) cannot access class com.sun.tools.javac.util.Context (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module @0x2b099be2
at com.google.googlejavaformat.java.RemoveUnusedImports.removeUnusedImports(RemoveUnusedImports.java:218)
... 142 more
This issue occurs when building at command line and in Intellij.
I tried adding the below workaround to my gradle.properties file
org.gradle.jvmargs=-Xms2g -Xmx8g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 \
--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
java version
✗ java -version
openjdk version "17.0.10" 2024-01-16
OpenJDK Runtime Environment Homebrew (build 17.0.10+0)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.10+0, mixed mode, sharing)
Originally posted by @rikintanna in https://github.com/google/google-java-format/issues/787#issuecomment-1971447073
- 主要言語
- 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 ·