Skip to content

Commit 14ae0a7

Browse files
vorburgergoogle-java-format Team
authored and
google-java-format Team
committed
Clarify impact of java version used on /google_java_format README.
Manually created Google internal equivalent of public #1228, just in case it's easier to review here instead of there; quote with rationale for this, from public PR description: It at first confused the hell out of me why clearly the exact SAME version of google-java-format worked great locally but failed with errors (due to my use of record matching pattern syntax) on a GitHub Action - until I've noticed that it still ran under Java 17 - and that this matters to google-java-format (my naive initial assumption was that only the google-java-format version itself was relevant). PiperOrigin-RevId: 741076633
1 parent 4e0eb5a commit 14ae0a7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ and run it with:
1616
java -jar /path/to/google-java-format-${GJF_VERSION?}-all-deps.jar <options> [files...]
1717
```
1818

19+
Note that it uses the `jdk.compiler` module to parse the Java source code. The
20+
`java` binary version used must therefore be from a JDK (not JRE) with a version
21+
equal to or newer than the Java language version of the files being formatted.
22+
An alternative is to use the available GraalVM based native binaries instead.
23+
1924
The formatter can act on whole files, on limited lines (`--lines`), on specific
2025
offsets (`--offset`), passing through to standard-out (default) or altered
2126
in-place (`--replace`).

0 commit comments

Comments
 (0)