Skip to content

Commit cac888e

Browse files
committed
List the JBang fix on Migrate
The JBang change of 2.98.0.5 goes on the list as the bug fix it is, although code that palantir-java-format has already formatted keeps its "// DEPS" and does not move: whoever migrates JBang scripts needs to know. The formatter handled a script's header wrongly. The space after the slashes hid //DEPS and the other directives from JBang, and the first line no longer ran from a shell. The item says so, links the JBang page, and says that spaces an earlier run added have to be removed by hand. The corpus paragraph now says the JBang fix changes nothing in the JDK 21 sources, which formatted identically with and without it when the fix was made (openjavaformat/open-java-format#91). The GitHub Action page gives 2.98.0.5 as the default of the version input, as the action's main branch now does (openjavaformat/open-java-format-action@80a52bb).
1 parent fe294a5 commit cac888e

2 files changed

Lines changed: 10 additions & 3 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.4` | The formatter version to download |
32+
| `version` | `2.98.0.5` | 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: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,21 @@ produces no formatting diff and needs no reformatting commit.
2727
instead of breaking at every dot.
2828
- Since 2.98.0.4 ([#73](https://github.com/openjavaformat/open-java-format/pull/73)): tabs at the
2929
end of a line in a comment are dropped, as trailing spaces already were.
30+
- Since 2.98.0.5 ([#91](https://github.com/openjavaformat/open-java-format/pull/91)): a bug that
31+
broke JBang scripts is fixed. The formatter handled their header wrongly: it put a space after the
32+
slashes, so `//DEPS` became `// DEPS`, which JBang does not read, and `///usr/bin/env jbang` on the
33+
first line became `/// usr/bin/env jbang`, which a shell cannot run. These lines now stay as
34+
written, see [JBang](library-rules/jbang.md). A script that was formatted before keeps its spaces:
35+
remove them by hand once.
3036

3137
Checked on 341 source files, about 24,000 lines: palantir-java-format 2.98.0 and open-java-format
3238
2.98.0.2 give byte-identical output. On the JDK 21 sources, 2.98.0.3 reformats 5 of the files that
3339
2.98.0.2 leaves unchanged when run again, all because of the string fix. In 2.98.0.4 the cast fix
3440
changes one statement, in `sun.rmi.transport.tcp.TCPTransport`; the switch change moves 57
3541
declarations in 51 files; and the banner change keeps 70 blank lines in 43 files, every one of them
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.
42+
present in the source. The class name, tab and JBang fixes change nothing there: no dotted name in
43+
the JDK runs through a one-letter class, no comment ends in a tab, and no file opens like a JBang
44+
script.
3845

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

0 commit comments

Comments
 (0)