Bump guava.version from 31.0.1-jre to 31.1-jre Bumps `guava.version` from 31.0.1-jre to 31.1-jre. Updates `guava` from 31.0.1-jre to 31.1-jre <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/google/guava/releases">guava's releases</a>.</em></p> <blockquote> <h2>31.1</h2> <h3>Maven</h3> <pre lang="xml"><code><dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>31.1-jre</version> <!-- or, for Android: --> <version>31.1-android</version> </dependency> </code></pre> <h3>Jar files</h3> <ul> <li><a href="https://repo1.maven.org/maven2/com/google/guava/guava/31.1-jre/guava-31.1-jre.jar">31.1-jre.jar</a></li> <li><a href="https://repo1.maven.org/maven2/com/google/guava/guava/31.1-android/guava-31.1-android.jar">31.1-android.jar</a></li> </ul> <p>Guava requires <a href="https://github.com/google/guava/wiki/UseGuavaInYourBuild#what-about-guavas-own-dependencies">one runtime dependency</a>, which you can download here:</p> <ul> <li><a href="https://repo1.maven.org/maven2/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar">failureaccess-1.0.1.jar</a></li> </ul> <h3>Javadoc</h3> <ul> <li><a href="http://guava.dev/releases/31.1-jre/api/docs/">31.1-jre</a></li> <li><a href="http://guava.dev/releases/31.1-android/api/docs/">31.1-android</a></li> </ul> <h3>JDiff</h3> <ul> <li><a href="http://guava.dev/releases/31.1-jre/api/diffs/">31.1-jre vs. 31.0.1-jre</a></li> <li><a href="http://guava.dev/releases/31.1-android/api/diffs/">31.1-android vs. 31.0.1-android</a></li> <li><a href="http://guava.dev/releases/31.1-android/api/androiddiffs/">31.1-android vs. 31.1-jre</a></li> </ul> <h3>Changelog</h3> <ul> <li><code>base</code>: Deprecated the <code>Throwables</code> methods <code>lazyStackTrace</code> and <code>lazyStackTraceIsLazy</code>. They are no longer useful on any current platform. (6ebd7d8648)</li> <li><code>collect</code>: Added a new method <code>ImmutableMap.Builder.buildKeepingLast()</code>, which keeps the last value for any given key rather than throwing an exception when a key appears more than once. (68500b2c09)</li> <li><code>collect</code>: As a side-effect of the <code>buildKeepingLast()</code> change, the idiom <code>ImmutableList.copyOf(Maps.transformValues(map, function))</code> may produce different results if <code>function</code> has side-effects. (This is not recommended.) (68500b2c09)</li> <li><code>hash</code>: Added <code>Hashing.fingerprint2011()</code>. (13f703c25f)</li> <li><code>io</code>: Changed <code>ByteStreams.nullOutputStream()</code> to follow the contract of <code>OutputStream.write</code> by throwing an exception if the range of bytes is out of bounds. (1cd85d01c9)</li> <li><code>net</code>: Added <code>@CheckReturnValue</code> to the package (with a few exceptions). (a0e2577de6)</li> <li><code>net</code>: Added <code>HttpHeaders</code> constant for <code>Access-Control-Allow-Private-Network</code>. (6dabbdf9c9)</li> <li><code>util.concurrent</code>: Added accumulate/update methods for <code>AtomicDouble</code> and <code>AtomicDoubleArray</code>. (2d875d327a)</li> </ul> <h4>APIs promoted from <code>@Beta</code></h4> <ul> <li><code>base</code>: <code>Throwables</code> methods <code>getCausalChain</code> and <code>getCauseAs</code> (dd462afa6b)</li> <li><code>collect</code>: <code>Streams</code> methods <code>mapWithIndex</code> and <code>findLast</code> (8079a29463)</li> <li><code>collect</code>: the remaining methods in <code>Comparators</code>: <code>min</code>, <code>max</code>, <code>lexicographical</code>, <code>emptiesFirst</code>, <code>emptiesLast</code>, <code>isInOrder</code>, <code>isInStrictOrder</code> (a3e411c3a4)</li> <li><code>escape</code>: various APIs (468c68a6ac)</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li>See full diff in <a href="https://github.com/google/guava/commits">compare view</a></li> </ul> </details> <br /> Updates `guava-testlib` from 31.0.1-jre to 31.1-jre <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/google/guava/releases">guava-testlib's releases</a>.</em></p> <blockquote> <h2>31.1</h2> <h3>Maven</h3> <pre lang="xml"><code><dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>31.1-jre</version> <!-- or, for Android: --> <version>31.1-android</version> </dependency> </code></pre> <h3>Jar files</h3> <ul> <li><a href="https://repo1.maven.org/maven2/com/google/guava/guava/31.1-jre/guava-31.1-jre.jar">31.1-jre.jar</a></li> <li><a href="https://repo1.maven.org/maven2/com/google/guava/guava/31.1-android/guava-31.1-android.jar">31.1-android.jar</a></li> </ul> <p>Guava requires <a href="https://github.com/google/guava/wiki/UseGuavaInYourBuild#what-about-guavas-own-dependencies">one runtime dependency</a>, which you can download here:</p> <ul> <li><a href="https://repo1.maven.org/maven2/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar">failureaccess-1.0.1.jar</a></li> </ul> <h3>Javadoc</h3> <ul> <li><a href="http://guava.dev/releases/31.1-jre/api/docs/">31.1-jre</a></li> <li><a href="http://guava.dev/releases/31.1-android/api/docs/">31.1-android</a></li> </ul> <h3>JDiff</h3> <ul> <li><a href="http://guava.dev/releases/31.1-jre/api/diffs/">31.1-jre vs. 31.0.1-jre</a></li> <li><a href="http://guava.dev/releases/31.1-android/api/diffs/">31.1-android vs. 31.0.1-android</a></li> <li><a href="http://guava.dev/releases/31.1-android/api/androiddiffs/">31.1-android vs. 31.1-jre</a></li> </ul> <h3>Changelog</h3> <ul> <li><code>base</code>: Deprecated the <code>Throwables</code> methods <code>lazyStackTrace</code> and <code>lazyStackTraceIsLazy</code>. They are no longer useful on any current platform. (6ebd7d8648)</li> <li><code>collect</code>: Added a new method <code>ImmutableMap.Builder.buildKeepingLast()</code>, which keeps the last value for any given key rather than throwing an exception when a key appears more than once. (68500b2c09)</li> <li><code>collect</code>: As a side-effect of the <code>buildKeepingLast()</code> change, the idiom <code>ImmutableList.copyOf(Maps.transformValues(map, function))</code> may produce different results if <code>function</code> has side-effects. (This is not recommended.) (68500b2c09)</li> <li><code>hash</code>: Added <code>Hashing.fingerprint2011()</code>. (13f703c25f)</li> <li><code>io</code>: Changed <code>ByteStreams.nullOutputStream()</code> to follow the contract of <code>OutputStream.write</code> by throwing an exception if the range of bytes is out of bounds. (1cd85d01c9)</li> <li><code>net</code>: Added <code>@CheckReturnValue</code> to the package (with a few exceptions). (a0e2577de6)</li> <li><code>net</code>: Added <code>HttpHeaders</code> constant for <code>Access-Control-Allow-Private-Network</code>. (6dabbdf9c9)</li> <li><code>util.concurrent</code>: Added accumulate/update methods for <code>AtomicDouble</code> and <code>AtomicDoubleArray</code>. (2d875d327a)</li> </ul> <h4>APIs promoted from <code>@Beta</code></h4> <ul> <li><code>base</code>: <code>Throwables</code> methods <code>getCausalChain</code> and <code>getCauseAs</code> (dd462afa6b)</li> <li><code>collect</code>: <code>Streams</code> methods <code>mapWithIndex</code> and <code>findLast</code> (8079a29463)</li> <li><code>collect</code>: the remaining methods in <code>Comparators</code>: <code>min</code>, <code>max</code>, <code>lexicographical</code>, <code>emptiesFirst</code>, <code>emptiesLast</code>, <code>isInOrder</code>, <code>isInStrictOrder</code> (a3e411c3a4)</li> <li><code>escape</code>: various APIs (468c68a6ac)</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li>See full diff in <a href="https://github.com/google/guava/commits">compare view</a></li> </ul> </details> <br /> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Fixes #754 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/754 from google:dependabot/maven/guava.version-31.1-jre 70a8d22d3181232e19775b25083779900e213972 PiperOrigin-RevId: 455648330
google-java-format is a program that reformats Java source code to comply with Google Java Style.
Download the formatter and run it with:
java -jar /path/to/google-java-format-${GJF_VERSION?}-all-deps.jar <options> [files...]
The formatter can act on whole files, on limited lines (--lines), on specific offsets (--offset), passing through to standard-out (default) or altered in-place (--replace).
To reformat changed lines in a specific patch, use google-java-format-diff.py.
Note: There is no configurability as to the formatter's algorithm for formatting. This is a deliberate design decision to unify our code formatting on a single format.
A google-java-format IntelliJ plugin is available from the plugin repository. To install it, go to your IDE's settings and select the Plugins category. Click the Marketplace tab, search for the google-java-format plugin, and click the Install button.
The plugin will be disabled by default. To enable it in the current project, go to File→Settings...→google-java-format Settings (or IntelliJ IDEA→Preferences...→Other Settings→google-java-format Settings on macOS) and check the Enable google-java-format checkbox. (A notification will be presented when you first open a project offering to do this for you.)
To enable it by default in new projects, use File→Other Settings→Default Settings....
When enabled, it will replace the normal Reformat Code action, which can be triggered from the Code menu or with the Ctrl-Alt-L (by default) keyboard shortcut.
The import ordering is not handled by this plugin, unfortunately. To fix the import order, download the IntelliJ Java Google Style file and import it into File→Settings→Editor→Code Style.
The latest version of the google-java-format Eclipse plugin can be downloaded from the releases page. Drop it into the Eclipse drop-ins folder to activate the plugin.
The plugin adds a google-java-format formatter implementation that can be configured in Window > Preferences > Java > Code Style > Formatter > Formatter Implementation.
The formatter can be used in software which generates java to output more legible java code. Just include the library in your maven/gradle/etc. configuration.
google-java-format uses internal javac APIs for parsing Java source. The following JVM flags are required when running on JDK 16 and newer, due to JEP 396: Strongly Encapsulate JDK Internals by Default:
--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
<dependency> <groupId>com.google.googlejavaformat</groupId> <artifactId>google-java-format</artifactId> <version>${google-java-format.version}</version> </dependency>
dependencies { implementation 'com.google.googlejavaformat:google-java-format:$googleJavaFormatVersion' }
You can then use the formatter through the formatSource methods. E.g.
String formattedSource = new Formatter().formatSource(sourceString);
or
CharSource source = ... CharSink output = ... new Formatter().formatSource(source, output);
Your starting point should be the instance methods of com.google.googlejavaformat.java.Formatter.
mvn install
Please see the contributors guide for details.
Copyright 2015 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.