Skip to content

@cushon cushon released this Mar 31, 2021

google-java-format now supports running on JDK 16. The following flags are required when running on JDK 16, due to JEP 396: Strongly Encapsulate JDK Internals by Default:

java \
  --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
  --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
  --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
  --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
  --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
  -jar google-java-format-1.10.0-all-deps.jar T...

Other changes:

  • Handle extra ; in import lists (b769e81)
  • Add missing space between unary - and negative literals (6da736d)
  • Fix an off-by-one issue on the reflowing of string literals (b9fd8d2)
Assets 6
1.9

@cushon cushon released this Aug 24, 2020

  • Add support for yield statements (#489)
  • Fix a crash in expression switches (#477)
Assets 6
1.8

@cushon cushon released this May 1, 2020

Changes:

  • The minimum supported runtime version is now JDK 11.
  • Initial support for Java 14 language features, including preview features. (Only available when running the formatter on JDK 14 or newer.)
  • Flag control of javadoc formatting (--skip-javadoc-formatting).
  • Reflowing string literals that exceed the column limit.

Fixes

  • Handle unary negation when formatting tabular arguments (#400)
  • Remove trailing tabs from comments to make behavior idempotent (#422)
  • Fix a crash on c-style arrays in parameters (#374)
  • Fix import reorderer to handle single-line-comments in imports (f246638)
  • Handle double semi-colons after package statements (5e114ca)
Assets 6
1.7

@cushon cushon released this Jan 9, 2019

Changes

  • Treat expressions ending in .stream() as a syntactic unit
  • Keep going if a file cannot be read, and report a non-zero exit status, similar to handling of syntax errors.
Assets 6
1.6

@cushon cushon released this May 25, 2018

Features

  • Don't format annotations as block-like constructs (#159)
  • Add horizontal whitespace between varargs specifiers and type annotations (#282)
  • Don't add spaces to //$NON-NLS-x$ comments (#221)
  • Unify breaks between type parameters
  • Add support for --assume-filename

Incompatible changes

  • Version 1.6.1 of the IntelliJ plugin now notifies if google-java-format hasn't been configured for new projects. (Version 1.6.0 of the plugin enabled the formatter by default, but this behaviour was reverted in 1.6.1. See #290.)

Bug Fixes

  • Don't crash on empty enum declarations (#281)
  • Don't crash on unusual line separators (#201)
Assets 7
1.5

@cushon cushon released this Oct 18, 2017

Features:

  • Improved support for checking if files are already formatted: --dry-run prints the paths of files whose contents would change if the formatter were run normally, and --set-exit-if-changed returns exit code 1 if there are any formatting changes. (#105)
  • Added support for javac-style @params files. (#77).

Bug fixes:

  • Improved partial formatting within switch statements (c63984a).
  • Improved import ordering logic to handle imports not separated by newlines (7225e17, 8364f6c).
Assets 7
1.4

@cushon cushon released this Aug 29, 2017

1.4 release

  • initial support for Java 9 language features (effectively final variables in try-with-resources, module-info.java files).
  • Remove java.lang imports
  • Handle varargs lambda parameters
  • Wrap line comments that exceed the column limit
  • Ensure leading spaces are present in line comments (//comment -> // comment).
  • Wrap before /*parameter=*/ comments.
  • Handle type-annotated varargs.
Assets 7