google-java-format 1.37.0: NoSuchMethodError on JavaFormatterOptions$Style.valueOf (Style is now a record)
Maintainer thường phản hồi trong vòng 1 ngày
@Goooler đang làm issue này rồi.
Từ ngày 3/10/2026.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- java
- Lĩnh vực
- build-system
Hướng nghiên cứu
Bắt đầu tại GoogleJavaFormatFormatterFunc, nơi kiểu google-java-format được phân giải, và so sánh reflection của adapter với API JavaFormatterOptions.Style của google-java-format 1.37.0. Tái hiện bằng cấu hình Maven đã được báo cáo và chạy mvn spotless:check; được xem là hoàn tất khi phiên bản 1.37.0 hoàn thành mà không có InvocationTargetException và các tùy chọn kiểu hiện có vẫn hoạt động.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Overriding the google-java-format version to 1.37.0 makes spotless:check fail with InvocationTargetException. Spotless then reports it as google-java-format(java.lang.reflect.InvocationTargetException) and gives no cause.
Environment
- spotless-maven-plugin 3.10.3 (spotless-lib 4.10.3)
- google-java-format 1.37.0 (works with 1.36.1)
- JDK 21 locally, and the same failure on the CI runner
Config
<googleJavaFormat>
<version>1.37.0</version>
<reflowLongStrings>true</reflowLongStrings>
<formatJavadoc>false</formatJavadoc>
</googleJavaFormat>
Cause
Running Maven with -Xlog:exceptions=info showed the wrapped error:
java.lang.NoSuchMethodError: 'JavaFormatterOptions$Style JavaFormatterOptions$Style.valueOf(java.lang.String)'
GoogleJavaFormatFormatterFunc calls JavaFormatterOptions.Style.valueOf(String). In 1.36.1, Style is an enum. In 1.37.0 it is a record (extends java.lang.Record, with a builder() and toBuilder()), and valueOf no longer exists. This looks related to the new --style=google|aosp flag. Style.GOOGLE and Style.AOSP still exist as static fields.
Ruled out
- The javac
--add-exportsflags: the 1.37.0 formatter works with them. - Guava version: it works with 32.1.3, 33.2.1 and 33.6.0.
- Missing APIs:
Builder.style,formatJavadoc,Formatter(JavaFormatterOptions),RemoveUnusedImports,ImportOrderer.reorderImports(String, Style)andStringWrapper.wrapare all present in 1.37.0.
Repro
Set <version>1.37.0</version> on the googleJavaFormat step, then run mvn spotless:check.
The adapter will need to map the style name to the new Style type, for example with Style.GOOGLE and Style.AOSP, instead of calling valueOf.
Downstream, this is blocking a Renovate bump: bytestreams-io/codec-core#164.
- Ngôn ngữ chính
- Java
- Star
- 5.7k
- Fork
- 565
- Merge trung bình
- 2 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 66
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của diffplug/spotless
-
Add support for org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_record_parameterĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
diffplug/spotless#3067 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 66/100
diffplug/spotless#3040 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của diffplug/spotless
Issue tương tự
-
enhancement good first issue
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 66/100
apache/fineract-consumer-facing#175 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] 订单:会员凭订单号即可取消其他会员的待付款订单(取消接口不校验订单归属)Có thể đã có người làm @dadiyang đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
macrozheng/mall#1016 ·
-
[Bug] The producer summary counts an unreported client version as a second version and warns about a version mixCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
apache/rocketmq-dashboard#6110 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Feature:Resolution
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
intellij-elixir/intellij-elixir#4396 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Python 3.15 supportCó thể đã có người làm @amnesiaof đã nhận hôm nay. Đang mởL: python L: python:uv
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
dependabot/dependabot-core#16524 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày