You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
google-java-format 1.37.0: NoSuchMethodError on JavaFormatterOptions$Style.valueOf (Style is now a record) #3126
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.
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-exports flags: 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) and StringWrapper.wrap are 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.
Activity
build(backend): link upstream Spotless issue for the gjf 1.36.1 pin (…
Goooler commentedon Oct 4, 2026
Addressed a fix to google/google-java-format#1472.
Update dependency google/google-java-format to v1.37.0
feat: check Java formatting with Spotless and google-java-format (#35)
Restore enum-compatible methods on `JavaFormatterOptions.Style`
Restore enum-compatible methods on `JavaFormatterOptions.Style`
Restore enum-compatible methods on `JavaFormatterOptions.Style`
Restore enum-compatible methods on `JavaFormatterOptions.Style`
Goooler commentedon Oct 13, 2026
Fixed in google/google-java-format@a51e46a.