Skip to content

Commit 1627ba4

Browse files
committed
List the class name and tab fixes on Migrate, with a link for each change
2.98.0.4 carries two more fixes that change code palantir-java-format 2.98.0 has already formatted: a one-letter class name such as Android's R no longer counts as a constant in a dotted name (openjavaformat/open-java-format#70), and tabs at the end of a line in a comment are dropped (openjavaformat/open-java-format#73). Neither shows on the JDK 21 sources, which have no such dotted name and no comment ending in a tab, and the corpus paragraph now says so. The other fixes of 2.98.0.4 leave code that palantir-java-format has already formatted as it is, so they stay off the list. Every item now links the pull request behind it. The string fix went to main without one, so it links the issue it closed, openjavaformat/open-java-format#32. The GitHub Action page gives 2.98.0.4 as the default of the version input, as the action's main branch now does (openjavaformat/open-java-format-action@83d0df8).
1 parent 215f758 commit 1627ba4

2 files changed

Lines changed: 24 additions & 12 deletions

File tree

‎docs/get-started/github-actions.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ the files that are not formatted and fails the job if there are any.
2929
3030
| Input | Default | Meaning |
3131
| --- | --- | --- |
32-
| `version` | `2.98.0.3` | The formatter version to download |
32+
| `version` | `2.98.0.4` | The formatter version to download |
3333
| `mode` | `changed` | `changed` checks the files of the pull request or push, `all` checks every `.java` file |
3434

3535
A workflow that still pins 2.98.0.1 stays on `@v1`: that version needs the `--ojf` flag, which `@v2`

‎docs/migrate.md‎

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,35 @@ open-java-format {{ ojf_version }} formats with the code of palantir-java-format
66
and built in the open. The output is the same except for the fixes below. Anywhere else, switching
77
produces no formatting diff and needs no reformatting commit.
88

9-
- Since 2.98.0.3: a long string is no longer split after an escaped backslash followed by `n`, as if
10-
that were a line break, and imports with comments between them are formatted rather than rejected.
11-
- Since 2.98.0.4: a cast to a parameterized type at the end of a call chain is no longer split
12-
inside its type, `(PrivilegedAction<` on one line and `String>)` on the next, when the chain is
13-
inlined but the type does not fit behind it. The call breaks its arguments one per line instead.
14-
- Since 2.98.0.4: a switch expression that initializes a variable or a field starts on the line of
15-
the declaration, `int x = switch (y) {`, with its cases eight columns further left, the shape a
16-
plain assignment already had. This is the one change of palantir-java-format 2.99.0, brought over.
17-
- Since 2.98.0.4: a comment that opens with `/***`, such as a banner, no longer counts as javadoc,
18-
so a blank line between it and the declaration after it stays, as after any other block comment.
9+
- Since 2.98.0.3 ([#32](https://github.com/openjavaformat/open-java-format/issues/32),
10+
[#44](https://github.com/openjavaformat/open-java-format/pull/44)): a long string is no longer
11+
split after an escaped backslash followed by `n`, as if that were a line break, and imports with
12+
comments between them are formatted rather than rejected.
13+
- Since 2.98.0.4 ([#78](https://github.com/openjavaformat/open-java-format/pull/78)): a cast to a
14+
parameterized type at the end of a call chain is no longer split inside its type,
15+
`(PrivilegedAction<` on one line and `String>)` on the next, when the chain is inlined but the
16+
type does not fit behind it. The call breaks its arguments one per line instead.
17+
- Since 2.98.0.4 ([#76](https://github.com/openjavaformat/open-java-format/pull/76)): a switch
18+
expression that initializes a variable or a field starts on the line of the declaration,
19+
`int x = switch (y) {`, with its cases eight columns further left, the shape a plain assignment
20+
already had. This is the one change of palantir-java-format 2.99.0, brought over.
21+
- Since 2.98.0.4 ([#74](https://github.com/openjavaformat/open-java-format/pull/74)): a comment that
22+
opens with `/***`, such as a banner, no longer counts as javadoc, so a blank line between it and
23+
the declaration after it stays, as after any other block comment.
24+
- Since 2.98.0.4 ([#70](https://github.com/openjavaformat/open-java-format/pull/70)): a one-letter
25+
class name such as Android's `R` no longer counts as a constant, so a dotted name through it that
26+
does not fit, such as `com.example.R.string.app_name`, keeps `com.example.R.string` together
27+
instead of breaking at every dot.
28+
- Since 2.98.0.4 ([#73](https://github.com/openjavaformat/open-java-format/pull/73)): tabs at the
29+
end of a line in a comment are dropped, as trailing spaces already were.
1930

2031
Checked on 341 source files, about 24,000 lines: palantir-java-format 2.98.0 and open-java-format
2132
2.98.0.2 give byte-identical output. On the JDK 21 sources, 2.98.0.3 reformats 5 of the files that
2233
2.98.0.2 leaves unchanged when run again, all because of the string fix. In 2.98.0.4 the cast fix
2334
changes one statement, in `sun.rmi.transport.tcp.TCPTransport`; the switch change moves 57
2435
declarations in 51 files; and the banner change keeps 70 blank lines in 43 files, every one of them
25-
present in the source.
36+
present in the source. The class name and tab fixes change nothing there: no dotted name in the JDK
37+
runs through a one-letter class, and no comment ends in a tab.
2638

2739
The Java packages are unchanged as well. Only the names in your build and your scripts change.
2840

0 commit comments

Comments
 (0)