Skip to content

21.1.2

Latest

Choose a tag to compare

@github-actions github-actions released this 28 Nov 21:35
Immutable release. Only release title and notes can be modified.
8c9018a

The formatter's output is the same as 21.1.1's, so this release needs no reformatting run. The Gradle plugin now formats Android modules, and the command line tool installs with Homebrew, Scoop, apt and mise.

Gradle plugin

  • formatDiff and the Spotless step now format the Java files of Android modules: those with com.android.application, com.android.library, com.android.dynamic-feature or com.android.test, from Android Gradle plugin 9.1 on. Up to 21.1.1 the plugin did nothing in a module without the java plugin: there was no formatDiff, and spotlessCheck passed whatever the files held. Both cover the java directories of every Android source set, and Java files in the kotlin directories are left out. The plugin reads the source sets from the build's own Android Gradle plugin and brings none of its own (#284, #288).

Command line

  • Homebrew on macOS and Linux, Scoop on Windows and apt on Ubuntu and Debian install the native binary and take each new release within the hour; mise installs it on macOS, Linux and Windows and pins its version per project. The commands are on the Command line page (#151, #152, #153, #260).
  • The release carries the Linux binaries as .deb packages too, open-java-format_21.1.2_amd64.deb and open-java-format_21.1.2_arm64.deb, signed and in checksums_sha256.txt like every other file. They install /usr/bin/open-java-format and need glibc 2.34 or later: Ubuntu 22.04, Debian 12 or newer (#289).

Formatter

  • Reading a comment no longer goes through reflection into javac. For every comment of every file the formatter looked up a field that javac has not had since JDK 15, caught the exception, and then copied the comment's text only to take its length (#286, #287).

Thanks

To Liam Miller-Cushon of google-java-format, whose change to reading comments, google-java-format#1546, is ported here.