Comparing v1.22.0...v1.23.0 · google/google-java-format
Commits on Apr 6, 2024
-
Support overlapping --lines ranges in google-java-format.
The strict behavior comes from the underlying ImmutableRangeSet.Builder class, which does not allow overlapping ranges to be added. Let's use TreeRangeSet instead. I have also updated the documentation for the --lines flag to make it clear that the line numbers are a closed-closed interval. Tested with: ``` blaze run :google_java_format_binary -- --lines=1:5 --lines=3:8 - < Foo.java ``` Before this CL the command fails with: ``` '--lines=1:5' '--lines=3:8' - Overlapping ranges not permitted but found [0..5) overlapping [2..8) ``` After this CL the command succeeds. PiperOrigin-RevId: 622410610
Commits on May 30, 2024
-
Prepare g-j-f for some internal javac API changes
* Refactor comment handling in tokenization to avoid extending javac's internal Comment. This prepares for upcoming JDK changes to the Comment API, which break the current subclass approach by changing the return type of `Comment#getPos`, see also similar changes to Error Prone in unknown commit * `JCCompilationUnit#getImports` no longer returns `JCImport`, as part of the changes for modular imports. Supporting modular imports is future work, this change just avoids a crash formatting the existing syntax on the latest JDK versions. PiperOrigin-RevId: 638669955
cushon authored and google-java-format Team committed
May 30, 2024
Commits on Jun 5, 2024
-
Fix modifier order handling for
non-sealed`non-sealed` is tokenized as three tokens, the modifier sorting logic was assuming it would show up as a single token. PiperOrigin-RevId: 640534518
cushon authored and google-java-format Team committed
Jun 5, 2024
Commits on Jun 17, 2024
-
Adjust indentation of line comments inside expression switches
For statement switches there's some ambiguity about whether a comment documents the previous or next case: ``` case 1: // case 1 falls through to 2 case 2: doSomething() ``` ``` // this is information about case 1 case 1: // this is information about case 2 case 2: doSomething() ``` For expression switches there is no fall through, so assume that a line comments before a case label always apply to the case label after it. PiperOrigin-RevId: 644163145cushon authored and google-java-format Team committed
Jun 17, 2024
Commits on Jul 17, 2024
-
1 Configuration menu