From 78736b69d4fedc22aeb3d91630b30ca0abeb89a6 Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Sat, 22 Mar 2025 17:11:03 +0100 Subject: [PATCH] docs: Clarify impact of java version used on README 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). --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 83a524bbd..8361157b4 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ and run it with: java -jar /path/to/google-java-format-${GJF_VERSION?}-all-deps.jar [files...] ``` +Note that it uses the `jdk.compiler` module to parse the Java source code. The `java` binary +version used must therefore be from a JDK (not JRE) that's at least as big as the files being formatted. +An alternative is to use the available GraalVM based native binaries instead. + The formatter can act on whole files, on limited lines (`--lines`), on specific offsets (`--offset`), passing through to standard-out (default) or altered in-place (`--replace`).