From 35e97e8fae4d9474f94f7dd474fc3ba921dafa24 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Sat, 20 Nov 2021 14:02:59 -0800 Subject: [PATCH 01/44] Update version number for 1.13.0 release PiperOrigin-RevId: 411296447 --- README.md | 10 +++++----- eclipse_plugin/META-INF/MANIFEST.MF | 2 +- eclipse_plugin/pom.xml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3b79cd0b..aa560505 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ and run it with: ``` -java -jar /path/to/google-java-format-1.12.0-all-deps.jar [files...] +java -jar /path/to/google-java-format-1.13.0-all-deps.jar [files...] ``` The formatter can act on whole files, on limited lines (`--lines`), on specific @@ -39,7 +39,7 @@ java \ --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.12.0-all-deps.jar [files...] + -jar google-java-format-1.13.0-all-deps.jar [files...] ``` ### IntelliJ, Android Studio, and other JetBrains IDEs @@ -71,7 +71,7 @@ and import it into File→Settings→Editor→Code Style. ### Eclipse Version 1.11 of the -[google-java-format Eclipse plugin](https://github.com/google/google-java-format/releases/download/v1.12.0/google-java-format-eclipse-plugin-1.12.0.jar) +[google-java-format Eclipse plugin](https://github.com/google/google-java-format/releases/download/v1.13.0/google-java-format-eclipse-plugin-1.13.0.jar) can be downloaded from the releases page. Drop it into the Eclipse [drop-ins folder](http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fp2_dropins_format.html) to activate the plugin. @@ -113,7 +113,7 @@ configuration. com.google.googlejavaformat google-java-format - 1.12.0 + 1.13.0 ``` @@ -121,7 +121,7 @@ configuration. ```groovy dependencies { - implementation 'com.google.googlejavaformat:google-java-format:1.12.0' + implementation 'com.google.googlejavaformat:google-java-format:1.13.0' } ``` diff --git a/eclipse_plugin/META-INF/MANIFEST.MF b/eclipse_plugin/META-INF/MANIFEST.MF index 34b1e8c8..91324539 100644 --- a/eclipse_plugin/META-INF/MANIFEST.MF +++ b/eclipse_plugin/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: google-java-format Bundle-SymbolicName: google-java-format-eclipse-plugin;singleton:=true Bundle-Vendor: Google -Bundle-Version: 1.11.0 +Bundle-Version: 1.13.0 Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.jdt.core;bundle-version="3.10.0", org.eclipse.jface, diff --git a/eclipse_plugin/pom.xml b/eclipse_plugin/pom.xml index 6b49c901..ee5635c4 100644 --- a/eclipse_plugin/pom.xml +++ b/eclipse_plugin/pom.xml @@ -22,7 +22,7 @@ com.google.googlejavaformat google-java-format-eclipse-plugin eclipse-plugin - 1.11.0 + 1.13.0 Google Java Format Plugin for Eclipse 4.5+ From 4347a6454978a5401a3b2e1ff851bea1400bb189 Mon Sep 17 00:00:00 2001 From: Michael Plump Date: Tue, 23 Nov 2021 09:43:58 -0800 Subject: [PATCH 02/44] Update the plugin to google-java-format 1.13.0. PiperOrigin-RevId: 411832812 --- idea_plugin/build.gradle | 8 ++++---- idea_plugin/resources/META-INF/plugin.xml | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/idea_plugin/build.gradle b/idea_plugin/build.gradle index 3d807af0..36c12f13 100644 --- a/idea_plugin/build.gradle +++ b/idea_plugin/build.gradle @@ -15,7 +15,7 @@ */ plugins { - id "org.jetbrains.intellij" version "0.7.2" + id "org.jetbrains.intellij" version "1.3.0" } repositories { @@ -23,7 +23,7 @@ repositories { } ext { - googleJavaFormatVersion = '1.10.0' + googleJavaFormatVersion = '1.13.0' } apply plugin: 'org.jetbrains.intellij' @@ -31,7 +31,7 @@ apply plugin: 'java' intellij { pluginName = "google-java-format" - version = "211.6693.65-EAP-SNAPSHOT" + version = "IC-213.5744.18-EAP-SNAPSHOT" } patchPluginXml { @@ -54,5 +54,5 @@ sourceSets { } dependencies { - compile "com.google.googlejavaformat:google-java-format:${googleJavaFormatVersion}" + implementation "com.google.googlejavaformat:google-java-format:${googleJavaFormatVersion}" } diff --git a/idea_plugin/resources/META-INF/plugin.xml b/idea_plugin/resources/META-INF/plugin.xml index b089ad60..60705902 100644 --- a/idea_plugin/resources/META-INF/plugin.xml +++ b/idea_plugin/resources/META-INF/plugin.xml @@ -28,6 +28,12 @@ +
1.13.0.0
+
Updated to use google-java-format 1.13.
+
1.12.0.0
+
Updated to use google-java-format 1.12.
+
1.11.0.0
+
Updated to use google-java-format 1.11.
1.10.0.0
Updated to use google-java-format 1.10.
1.9.0.0
From 7bc5daec11d91caf28ab8b1bd61d6beaf9a59c15 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Wed, 22 Dec 2021 08:01:12 -0800 Subject: [PATCH 03/44] Remove some reflection now that we require JDK 11 to run the formatter PiperOrigin-RevId: 417821422 --- .../googlejavaformat/java/Formatter.java | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/core/src/main/java/com/google/googlejavaformat/java/Formatter.java b/core/src/main/java/com/google/googlejavaformat/java/Formatter.java index 3e973958..aac829dd 100644 --- a/core/src/main/java/com/google/googlejavaformat/java/Formatter.java +++ b/core/src/main/java/com/google/googlejavaformat/java/Formatter.java @@ -14,8 +14,6 @@ package com.google.googlejavaformat.java; -import static com.google.common.base.StandardSystemProperty.JAVA_CLASS_VERSION; -import static com.google.common.base.StandardSystemProperty.JAVA_SPECIFICATION_VERSION; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.common.collect.ImmutableList; @@ -42,7 +40,6 @@ import com.sun.tools.javac.util.Options; import java.io.IOError; import java.io.IOException; -import java.lang.reflect.Method; import java.net.URI; import java.util.ArrayList; import java.util.Collection; @@ -154,7 +151,7 @@ public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOExcept OpsBuilder builder = new OpsBuilder(javaInput, javaOutput); // Output the compilation unit. JavaInputAstVisitor visitor; - if (getMajor() >= 14) { + if (Runtime.version().feature() >= 14) { try { visitor = Class.forName("com.google.googlejavaformat.java.java14.Java14InputAstVisitor") @@ -176,23 +173,6 @@ public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOExcept javaOutput.flush(); } - // Runtime.Version was added in JDK 9, so use reflection to access it to preserve source - // compatibility with Java 8. - private static int getMajor() { - try { - Method versionMethod = Runtime.class.getMethod("version"); - Object version = versionMethod.invoke(null); - return (int) version.getClass().getMethod("major").invoke(version); - } catch (Exception e) { - // continue below - } - int version = (int) Double.parseDouble(JAVA_CLASS_VERSION.value()); - if (49 <= version && version <= 52) { - return version - (49 - 5); - } - throw new IllegalStateException("Unknown Java version: " + JAVA_SPECIFICATION_VERSION.value()); - } - static boolean errorDiagnostic(Diagnostic input) { if (input.getKind() != Diagnostic.Kind.ERROR) { return false; From 06a2105be2d73bbbdc6cb6f8dc43f84e2eb00e07 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Fri, 24 Dec 2021 09:18:41 -0800 Subject: [PATCH 04/44] Don't use single-line for for javadoc without a summary fragment Using the multi-line form here may call attention to the missing summary fragment. The style guide can also be read as discouraging the single-line form for non-required javadoc missing a summary fragment (see b/74239048#comment4), but I'm not sure that's the intent, and I'm looking at changing it (unknown commit). PiperOrigin-RevId: 418174535 --- .../java/javadoc/JavadocFormatter.java | 11 +++++--- .../java/JavadocFormattingTest.java | 25 ++++++++++++++++++- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/google/googlejavaformat/java/javadoc/JavadocFormatter.java b/core/src/main/java/com/google/googlejavaformat/java/javadoc/JavadocFormatter.java index 5addc677..06176b54 100644 --- a/core/src/main/java/com/google/googlejavaformat/java/javadoc/JavadocFormatter.java +++ b/core/src/main/java/com/google/googlejavaformat/java/javadoc/JavadocFormatter.java @@ -168,10 +168,13 @@ private static Token standardize(Token token, Token standardToken) { private static String makeSingleLineIfPossible(int blockIndent, String input) { int oneLinerContentLength = MAX_LINE_LENGTH - "/** */".length() - blockIndent; Matcher matcher = ONE_CONTENT_LINE_PATTERN.matcher(input); - if (matcher.matches() && matcher.group(1).isEmpty()) { - return "/** */"; - } else if (matcher.matches() && matcher.group(1).length() <= oneLinerContentLength) { - return "/** " + matcher.group(1) + " */"; + if (matcher.matches()) { + String line = matcher.group(1); + if (line.isEmpty()) { + return "/** */"; + } else if (line.length() <= oneLinerContentLength && !line.startsWith("@")) { + return "/** " + line + " */"; + } } return input; } diff --git a/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java b/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java index f5103d9b..9d29eef2 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java @@ -937,7 +937,9 @@ public void onlyParams() { "class Test {}", }; String[] expected = { - "/** @param this is a param */", // + "/**", // + " * @param this is a param", + " */", "class Test {}", }; doFormatTest(input, expected); @@ -1415,4 +1417,25 @@ public void u2028LineSeparator() { }; doFormatTest(input, expected); } + + @Test + public void missingSummaryFragment() { + String[] input = { + "public class Foo {", + " /**", + " * @return something.", + " */", + " public void setSomething() {}", + "}", + }; + String[] expected = { + "public class Foo {", + " /**", + " * @return something.", + " */", + " public void setSomething() {}", + "}", + }; + doFormatTest(input, expected); + } } From 7677caeb1c2c77c2df0d2b5cc0575cf33aa55afa Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Fri, 24 Dec 2021 10:56:15 -0800 Subject: [PATCH 05/44] Automated rollback of commit 06a2105be2d73bbbdc6cb6f8dc43f84e2eb00e07. *** Reason for rollback *** Broke integration tests, will fix forward later *** Original change description *** Don't use single-line for for javadoc without a summary fragment Using the multi-line form here may call attention to the missing summary fragment. The style guide can also be read as discouraging the single-line form for non-required javadoc missing a summary fragment (see b/74239048#comment4), but I'm not sure that's the intent, and I'm looking at changing it (unknown commit). *** PiperOrigin-RevId: 418182032 --- .../java/javadoc/JavadocFormatter.java | 11 +++----- .../java/JavadocFormattingTest.java | 25 +------------------ 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/core/src/main/java/com/google/googlejavaformat/java/javadoc/JavadocFormatter.java b/core/src/main/java/com/google/googlejavaformat/java/javadoc/JavadocFormatter.java index 06176b54..5addc677 100644 --- a/core/src/main/java/com/google/googlejavaformat/java/javadoc/JavadocFormatter.java +++ b/core/src/main/java/com/google/googlejavaformat/java/javadoc/JavadocFormatter.java @@ -168,13 +168,10 @@ private static Token standardize(Token token, Token standardToken) { private static String makeSingleLineIfPossible(int blockIndent, String input) { int oneLinerContentLength = MAX_LINE_LENGTH - "/** */".length() - blockIndent; Matcher matcher = ONE_CONTENT_LINE_PATTERN.matcher(input); - if (matcher.matches()) { - String line = matcher.group(1); - if (line.isEmpty()) { - return "/** */"; - } else if (line.length() <= oneLinerContentLength && !line.startsWith("@")) { - return "/** " + line + " */"; - } + if (matcher.matches() && matcher.group(1).isEmpty()) { + return "/** */"; + } else if (matcher.matches() && matcher.group(1).length() <= oneLinerContentLength) { + return "/** " + matcher.group(1) + " */"; } return input; } diff --git a/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java b/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java index 9d29eef2..f5103d9b 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java @@ -937,9 +937,7 @@ public void onlyParams() { "class Test {}", }; String[] expected = { - "/**", // - " * @param this is a param", - " */", + "/** @param this is a param */", // "class Test {}", }; doFormatTest(input, expected); @@ -1417,25 +1415,4 @@ public void u2028LineSeparator() { }; doFormatTest(input, expected); } - - @Test - public void missingSummaryFragment() { - String[] input = { - "public class Foo {", - " /**", - " * @return something.", - " */", - " public void setSomething() {}", - "}", - }; - String[] expected = { - "public class Foo {", - " /**", - " * @return something.", - " */", - " public void setSomething() {}", - "}", - }; - doFormatTest(input, expected); - } } From 3b70603449ef7411043a81105919bcda046bd062 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Wed, 29 Dec 2021 18:06:00 -0800 Subject: [PATCH 06/44] Specify JVM flags required by turbine using `.mvn/jvm.config` see https://github.com/google/error-prone/issues/2786 PiperOrigin-RevId: 418873888 --- .mvn/jvm.config | 10 ++++++++++ pom.xml | 12 ------------ 2 files changed, 10 insertions(+), 12 deletions(-) create mode 100644 .mvn/jvm.config diff --git a/.mvn/jvm.config b/.mvn/jvm.config new file mode 100644 index 00000000..504456f9 --- /dev/null +++ b/.mvn/jvm.config @@ -0,0 +1,10 @@ +--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.main=ALL-UNNAMED +--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED +--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED +--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED +--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED +--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED +--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED +--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED diff --git a/pom.xml b/pom.xml index 75a18293..772a16b8 100644 --- a/pom.xml +++ b/pom.xml @@ -191,19 +191,7 @@ ${java.version} ${java.version} UTF-8 - true - - -J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED - -J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED - -J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED - -J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED - -J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED - -J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED - -J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED - -J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED - -J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED - -J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED -XDcompilePolicy=simple -Xplugin:ErrorProne From ef0bec605e2de3f9baf550d5f90daad1b5c49329 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Wed, 12 Jan 2022 11:01:25 -0800 Subject: [PATCH 07/44] Enable dependabot PiperOrigin-RevId: 421344211 --- .github/dependabot.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..b76b8957 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "maven" + directory: "/" + schedule: + interval: "daily" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" From de9e3b722356fb6f55ef5ad886a1fa242ff74fd4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Jan 2022 13:59:12 -0800 Subject: [PATCH 08/44] Bump maven-source-plugin from 2.1.2 to 3.2.1 Bumps [maven-source-plugin](https://github.com/apache/maven-source-plugin) from 2.1.2 to 3.2.1.
Commits
  • a59a2e4 [maven-release-plugin] prepare release maven-source-plugin-3.2.1
  • c954a7e make build as reproducible as possible for now
  • d5b9878 [MSOURCES-123] set archiver reproducible mode earlier
  • 258d666 MSOURCES-122 make output independant from OS newline
  • 5b4e02f [maven-release-plugin] prepare for next development iteration
  • 2a74824 [maven-release-plugin] prepare release maven-source-plugin-3.2.0
  • 816ebc4 MSOURCES-120 fix reproducible IT: remove plugin version from pom.xml
  • 32f122a MSOURCES-120 make output jar file binary Reproducible
  • 6e715b1 [MSOURCES-95] Source JAR is re-created even if sources are not changed
  • 9154e1a [maven-release-plugin] prepare for next development iteration
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.apache.maven.plugins:maven-source-plugin&package-manager=maven&previous-version=2.1.2&new-version=3.2.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) 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) ---
Dependabot commands and options
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)
Fixes #708 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/708 from google:dependabot/maven/org.apache.maven.plugins-maven-source-plugin-3.2.1 8062a1f65f10197bfbb9dcf614d4945ac46b0acc PiperOrigin-RevId: 421388226 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 772a16b8..35904c65 100644 --- a/pom.xml +++ b/pom.xml @@ -166,7 +166,7 @@ maven-source-plugin - 2.1.2 + 3.2.1 maven-javadoc-plugin From e01e66cfecd0b411ec134ac70f73a95c82cb0430 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Jan 2022 13:59:56 -0800 Subject: [PATCH 09/44] Bump build-helper-maven-plugin from 3.0.0 to 3.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [build-helper-maven-plugin](https://github.com/mojohaus/build-helper-maven-plugin) from 3.0.0 to 3.3.0.
Release notes

Sourced from build-helper-maven-plugin's releases.

3.3.0

Changes

  • Fixes #108 - released-version does not detect version if maven repository is not configured to look for snapshot (#109) @​stefanseifert
  • Add missing whitespace to output of reserve-network-port (#101) @​albers

🚀 New features and improvements

  • Provide the Mojos logger as variable in the Interpreter context (#72) @​MeyerNils

📦 Dependency updates

👻 Maintenance

build-helper-maven-plugin-3.2.0

Changelog: https://github.com/mojohaus/build-helper-maven-plugin/milestone/6?closed=1

build-helper-maven-plugin-3.1.0

Changelog: https://github.com/mojohaus/build-helper-maven-plugin/issues?q=is%3Aissue+milestone%3A3.1.0+is%3Aclosed

Commits
  • f1fac8c [maven-release-plugin] prepare release build-helper-maven-plugin-3.3.0
  • 3fed18c use version-resolver for release drafter to apply semantic versioning e.g. if...
  • 4d6ca94 allow to run release-drafter on workflow_dispatch for testing
  • b4e5d5a Provide the Mojos logger as variable in the Interpreter context (#72)
  • bda39bc set min. java version to java 8
  • 5f69431 Bump testng from 6.9.9 to 7.4.0 (#116)
  • 5796839 Bump assertj-core from 1.7.1 to 3.22.0
  • e916f57 Bump maven-plugin-annotations from 3.5 to 3.6.2
  • 158475c Bump mojo-parent from 61 to 65
  • 5360a59 Merge pull request #114 from mojohaus/feature/github-actions
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.codehaus.mojo:build-helper-maven-plugin&package-manager=maven&previous-version=3.0.0&new-version=3.3.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) 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) ---
Dependabot commands and options
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)
Fixes #705 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/705 from google:dependabot/maven/org.codehaus.mojo-build-helper-maven-plugin-3.3.0 fcee6b1504891934f9d49cb216f9dc72c1c71125 PiperOrigin-RevId: 421388545 --- core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pom.xml b/core/pom.xml index 5ebdb591..80fa4d9d 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -191,7 +191,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.0.0 + 3.3.0 add-source From 427a2bde4e5b2d66ff6425e345f8c15612adba18 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Jan 2022 14:00:14 -0800 Subject: [PATCH 10/44] Bump maven-surefire-plugin from 2.18 to 2.22.2 Bumps [maven-surefire-plugin](https://github.com/apache/maven-surefire) from 2.18 to 2.22.2.
Commits
  • d96b95c [maven-release-plugin] prepare release surefire-2.22.2
  • 4a2aafc Remove Travis file
  • 7b9ec3f Remove JUnit SNAPSHOT argument from IT
  • 18b4078 [SUREFIRE-1614] JUnit Runner that writes to System.out corrupts Surefire's ST...
  • af417b8 prepare for next development iteration
  • c23c8b9 [maven-release-plugin] prepare release surefire-2.22.1_vote-1
  • 5376261 [SUREFIRE-1564] Can't override platform version through project/plugin depend...
  • 242c0e8 [SUREFIRE-1564] Can't override platform version through project/plugin depend...
  • 25fadfc CheckTestNgSuiteXmlIT should not be ignored
  • 57fbb16 [SUREFIRE-1532] MIME type for javascript is now officially application/javasc...
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.apache.maven.plugins:maven-surefire-plugin&package-manager=maven&previous-version=2.18&new-version=2.22.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) 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) ---
Dependabot commands and options
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)
Fixes #710 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/710 from google:dependabot/maven/org.apache.maven.plugins-maven-surefire-plugin-2.22.2 78d9ce680ab611f8896772fbbf579b37146fe3c6 PiperOrigin-RevId: 421388633 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 35904c65..edc29584 100644 --- a/pom.xml +++ b/pom.xml @@ -264,7 +264,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.18 + 2.22.2 From 4424715f9b2d3432c2c5b0559d90070d2bf11452 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Jan 2022 14:00:45 -0800 Subject: [PATCH 11/44] Bump checker-qual from 3.6.1 to 3.21.1 Bumps [checker-qual](https://github.com/typetools/checker-framework) from 3.6.1 to 3.21.1.
Release notes

Sourced from checker-qual's releases.

Checker Framework 3.21.1

Version 3.21.1 (January 7, 2022)

User-visible changes:

The Checker Framework Gradle Plugin now works incrementally: if you change just one source file, then Gradle will recompile just that file rather than all files.

Closed issues: #2401, #4994, #4995, #4996.

Checker Framework 3.21.0

Version 3.21.0 (December 17, 2021)

User-visible changes:

The Checker Framework now more precisely computes the type of a switch expression.

Implementation details:

The dataflow framework now analyzes switch expressions and switch statements that use the new -> case syntax. To do so, a new node, SwitchExpressionNode, was added.

Closed issues: #2373, #4934, #4977, #4979, #4987.

Checker Framework 3.20.0

Version 3.20.0 (December 6, 2021)

User-visible changes:

The Checker Framework now runs on code that contains switch expressions and switch statements that use the new -> case syntax, but treats them conservatively. A future version will improve precision.

Implementation details:

The dataflow framework can be run on code that contains switch expressions and switch statements that use the new -> case syntax, but it does not yet analyze the cases in a switch expression and it treats -> as :. A future version will do so.

Removed methods and classes that have been deprecated for more than one year:

  • Old way of constructing qualifier hierarchies
  • @SuppressWarningsKeys
  • RegularBlock.getContents()
  • TestUtilities.testBooleanProperty()
  • CFAbstractTransfer.getValueWithSameAnnotations()

Closed issues: #4911, #4948, #4965.

Checker Framework 3.19.0

Version 3.19.0 (November 1, 2021)

... (truncated)

Changelog

Sourced from checker-qual's changelog.

Version 3.21.1 (January 7, 2022)

User-visible changes:

The Checker Framework Gradle Plugin now works incrementally: if you change just one source file, then Gradle will recompile just that file rather than all files.

Closed issues: #2401, #4994, #4995, #4996.

Version 3.21.0 (December 17, 2021)

User-visible changes:

The Checker Framework now more precisely computes the type of a switch expression.

Implementation details:

The dataflow framework now analyzes switch expressions and switch statements that use the new -> case syntax. To do so, a new node, SwitchExpressionNode, was added.

Closed issues: #2373, #4934, #4977, #4979, #4987.

Version 3.20.0 (December 6, 2021)

User-visible changes:

The Checker Framework now runs on code that contains switch expressions and switch statements that use the new -> case syntax, but treats them conservatively. A future version will improve precision.

Implementation details:

The dataflow framework can be run on code that contains switch expressions and switch statements that use the new -> case syntax, but it does not yet analyze the cases in a switch expression and it treats -> as :. A future version will do so.

Removed methods and classes that have been deprecated for more than one year:

  • Old way of constructing qualifier hierarchies
  • @SuppressWarningsKeys
  • RegularBlock.getContents()
  • TestUtilities.testBooleanProperty()

... (truncated)

Commits
  • dd715c3 new release 3.21.1
  • 3820124 Prep for release.
  • 673b126 Capture enclosing types
  • 269bca0 Checker Framework Gradle Plugin is now incremental
  • c73c4f8 In TreeScanners, ensure "scan" is called so that Java 17+ trees are visited p...
  • ed70606 Add synthetic variables to CFG for ternary expressions (#5000)
  • 3f9646e When releasing, make Randoop use the latest version of the Checker Framework
  • 2ee909e Update BCEL line number (#4999)
  • d3540b9 Bump com.github.johnrengelman.shadow from 7.1.1 to 7.1.2
  • 8e008df Update for next release.
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.checkerframework:checker-qual&package-manager=maven&previous-version=3.6.1&new-version=3.21.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) 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) ---
Dependabot commands and options
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)
Fixes #709 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/709 from google:dependabot/maven/org.checkerframework-checker-qual-3.21.1 ca33afc41d5b68ae67f014293d970009ae65f7e9 PiperOrigin-RevId: 421388780 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index edc29584..cf70803d 100644 --- a/pom.xml +++ b/pom.xml @@ -92,7 +92,7 @@ 1.8 30.1.1-jre 1.0 - 3.6.1 + 3.21.1 2.7.1 1.8.2 1.0 From bfb0649567b3e85deb70992765cc310fbd2fe9c3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Jan 2022 14:02:34 -0800 Subject: [PATCH 12/44] Bump styfle/cancel-workflow-action from 0.8.0 to 0.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [styfle/cancel-workflow-action](https://github.com/styfle/cancel-workflow-action) from 0.8.0 to 0.9.1.
Release notes

Sourced from styfle/cancel-workflow-action's releases.

0.9.1

Patches

  • Fix: cancelling jobs from different repos where two branches have the same name: #105
  • Fix: use getBooleanInput instead of getInput: #92
  • Chore: add permissions configuration in the README.md: #96
  • Chore: add prettier config, format file, add lint workflow: #63
  • Chore: create dependabot.yml: #68
  • Bump typescript from 4.1.5 to 4.2.4: #71
  • Bump actions/setup-node requirement to v2.1.5: #69
  • Bump @​vercel/ncc to 0.28.3: #73
  • Bump @​actions/core from 1.2.6 to 1.2.7: #74
  • Bump @​vercel/ncc from 0.28.3 to 0.28.5: #81
  • Bump @​actions/core from 1.2.7 to 1.3.0: #90
  • Bump prettier from 2.2.1 to 2.3.0: #85
  • Bump @​vercel/ncc from 0.28.5 to 0.28.6: #95
  • Bump typescript from 4.2.4 to 4.3.2: #94
  • Bump prettier from 2.3.0 to 2.3.1: #97
  • Bump typescript from 4.3.2 to 4.3.4: #99
  • Bump prettier from 2.3.1 to 2.3.2: #100
  • Bump typescript from 4.3.4 to 4.3.5: #101
  • Bump husky from 6.0.0 to 7.0.0: #102
  • Bump husky from 7.0.0 to 7.0.1: #103

Credits

Huge thanks to @​mikehardy, @​MichaelDeBoey, @​Warashi, @​adrienbernede, and @​spaceface777 for helping!

0.9.0

Minor Changes

  • Add all_but_latest flag - cancel all workflows but the latest: #35
  • Cleanup all_but_latest: #67

Credits

Huge thanks to @​thomwiggers for helping!

Commits
  • a40b884 0.9.1
  • a66ae1f fix cancelling jobs from different repos where two branches have the same nam...
  • b54f1a5 Bump husky from 7.0.0 to 7.0.1 (#103)
  • cc6225c Bump husky from 6.0.0 to 7.0.0 (#102)
  • c94109d Bump typescript from 4.3.4 to 4.3.5 (#101)
  • fc3581b Bump prettier from 2.3.1 to 2.3.2 (#100)
  • 6f9f8b4 Bump typescript from 4.3.2 to 4.3.4 (#99)
  • 6135c0f Bump prettier from 2.3.0 to 2.3.1 (#97)
  • 531a036 chore: add permissions configuration in the README.md (#96)
  • 1f10757 Bump typescript from 4.2.4 to 4.3.2 (#94)
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=styfle/cancel-workflow-action&package-manager=github_actions&previous-version=0.8.0&new-version=0.9.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) 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) ---
Dependabot commands and options
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)
Fixes #706 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/706 from google:dependabot/github_actions/styfle/cancel-workflow-action-0.9.1 61f4e96d8a56ca6e314ad05dfa8693195deeceb6 PiperOrigin-RevId: 421389297 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d3dbc75..e15d01cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: continue-on-error: ${{ matrix.experimental }} steps: - name: Cancel previous - uses: styfle/cancel-workflow-action@0.8.0 + uses: styfle/cancel-workflow-action@0.9.1 with: access_token: ${{ github.token }} - name: 'Check out repository' From c3beef135f2c651a77d1097abbbc813e7e0e5b02 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Jan 2022 14:02:51 -0800 Subject: [PATCH 13/44] Bump maven-shade-plugin from 2.4.3 to 3.2.4 Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 2.4.3 to 3.2.4.
Commits
  • 768092f [maven-release-plugin] prepare release maven-shade-plugin-3.2.4
  • 4f83ae6 [MSHADE-363] IT to check new Reproducible transformer with old plugin
  • 229f4d7 [MSHADE-363] add ReproducibleResourceTransformer to keep compatibility
  • 51bbf72 [MSHADE-363] add IT showing broken compatibility
  • 3691f60 Merge pull request #48 from apache/MSHADE-364
  • 34736cc [MSHADE-364] drop duplicate resource warning when the resource is handled by ...
  • 830d71a [MSHADE-365] put Properties transformers in separate table
  • ecaa5ee README improvement
  • 9a5b0f8 replace deprecated method (#46)
  • c02f7d6 [MSHADE-360] avoid PrintWriter (#44)
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.apache.maven.plugins:maven-shade-plugin&package-manager=maven&previous-version=2.4.3&new-version=3.2.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) 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) ---
Dependabot commands and options
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)
Fixes #707 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/707 from google:dependabot/maven/org.apache.maven.plugins-maven-shade-plugin-3.2.4 3c701a3ffc0a0b3e7f99a252dd07a2753d8624ab PiperOrigin-RevId: 421389390 --- core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pom.xml b/core/pom.xml index 80fa4d9d..67388fe4 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -119,7 +119,7 @@ org.apache.maven.plugins maven-shade-plugin - 2.4.3 + 3.2.4 shade-all-deps From d46fcf081d365b06d0b850f4acf479b5e38d8afe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 14 Jan 2022 16:37:06 -0800 Subject: [PATCH 14/44] Bump maven-jar-plugin from 3.0.2 to 3.2.2 Bumps [maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 3.0.2 to 3.2.2.
Commits
  • d37e995 [maven-release-plugin] prepare release maven-jar-plugin-3.2.2
  • 7bb0bfc [MJAR-284] Remove override for Plexus Archiver
  • a3e424d [MJAR-283] Upgrade Plexus Utils to 3.3.1
  • 95bc15b [maven-release-plugin] prepare for next development iteration
  • 50a8e0b [maven-release-plugin] prepare release maven-jar-plugin-3.2.1
  • 0fb2bf0 Proper uppercase JAR
  • e44e5f2 [MJAR-282] Upgrade Maven Archiver to 3.5.2
  • 34d62b6 Bump maven-archiver from 3.5.0 to 3.5.1
  • a496294 use shared gh action - v1 (#28)
  • a7cfde9 Bump junit from 4.13 to 4.13.2
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.apache.maven.plugins:maven-jar-plugin&package-manager=maven&previous-version=3.0.2&new-version=3.2.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) 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) ---
Dependabot commands and options
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)
Fixes #712 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/712 from google:dependabot/maven/org.apache.maven.plugins-maven-jar-plugin-3.2.2 fcb656bd1951005c08df259410d4d673b44e6d91 PiperOrigin-RevId: 421939437 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index cf70803d..86d0753d 100644 --- a/pom.xml +++ b/pom.xml @@ -162,7 +162,7 @@
maven-jar-plugin - 3.0.2 + 3.2.2 maven-source-plugin From 74ba729707d2b2cb9fe7fbbc3f22edff58502432 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Sat, 22 Jan 2022 00:00:17 -0800 Subject: [PATCH 15/44] Update dependency versions PiperOrigin-RevId: 423482707 --- core/pom.xml | 7 ++++++- pom.xml | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 67388fe4..39b9a3d9 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -75,10 +75,15 @@ com.google.truth truth + + com.google.truth.extensions + truth-java8-extension + test + com.google.testing.compile compile-testing - 0.15 + 0.19 test diff --git a/pom.xml b/pom.xml index 86d0753d..3f7baa0d 100644 --- a/pom.xml +++ b/pom.xml @@ -135,7 +135,7 @@ junit junit - 4.13.1 + 4.13.2 test @@ -150,6 +150,12 @@ ${truth.version} test + + com.google.truth.extensions + truth-java8-extension + ${truth.version} + test + From 8b2601315faacca21086348e9b304ebae954681c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jan 2022 06:43:09 -0800 Subject: [PATCH 16/44] Bump error_prone_annotations from 2.7.1 to 2.10.0 Bumps [error_prone_annotations](https://github.com/google/error-prone) from 2.7.1 to 2.10.0.
Release notes

Sourced from error_prone_annotations's releases.

Error Prone 2.10.0

New checks

Fixed issues: #2616, #2629

Full Changelog: https://github.com/google/error-prone/compare/v2.9.0...v2.10.0

Error Prone 2.9.0

Release Error Prone 2.9.0

New checks:

  • DeprecatedVariable
  • PublicApiNamedStreamShouldReturnStream

Fixes #2124, #2371, #2393, #2470

Error Prone 2.8.1

This release adds a new check (LoopOverCharArray), and a handful of other small improvements (https://github.com/google/error-prone/compare/v2.8.0...v2.8.1).

Error Prone 2.8.0

New Checks:

Fixes #1652, #2122, #2122, #2366, #2404, #2411

Commits
  • 199a31b Release Error Prone 2.10.0
  • 99cdb15 Always annotate arrays now that we place type-use annotations in the right pl...
  • 0fc9146 Recognize libcore.util.Nullable as type-use, and add a TODO about "hybrid" an...
  • 0f34024 Move check for the regex "." to a new WARNING-level check
  • eb3708a Delete obsolete travis config
  • 5538acc Automated rollback of commit 34d98e8cf1d8da2dc6d261d70c85e96dc4a0d031.
  • f91fff5 ASTHelpers: add getAnnotations method, to allow extraction of annotations fro...
  • cdfa8b8 Add the DistinctVarargs BugChecker. This will generate warning when method ex...
  • 122e512 Add InlineMe:CheckFixCompiles flag, which allows InlineMe users to optional...
  • dd91993 Add ByteString.fromHex to AlwaysThrows
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.errorprone:error_prone_annotations&package-manager=maven&previous-version=2.7.1&new-version=2.10.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) 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) ---
Dependabot commands and options
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)
Fixes #721 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/721 from google:dependabot/maven/com.google.errorprone-error_prone_annotations-2.10.0 73eee1c3efddbb740dc97e76495541c92d9fc0c9 PiperOrigin-RevId: 423801674 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3f7baa0d..894b9dd6 100644 --- a/pom.xml +++ b/pom.xml @@ -93,7 +93,7 @@ 30.1.1-jre 1.0 3.21.1 - 2.7.1 + 2.10.0 1.8.2 1.0 3.1.0 From 8a7ab0d7a8c5977742c884f07ff523dffc09d909 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jan 2022 06:43:36 -0800 Subject: [PATCH 17/44] Bump maven-gpg-plugin from 1.4 to 3.0.1 Bumps [maven-gpg-plugin](https://github.com/apache/maven-gpg-plugin) from 1.4 to 3.0.1.
Commits
  • 5255080 [maven-release-plugin] prepare release maven-gpg-plugin-3.0.1
  • e4dc062 [MGPG-79] fix handling of external pinentry programs in case the passphrase i...
  • 5902b2b deps: update JUnit
  • 12fbd63 Merge pull request #10 from Syquel/bugfix/MGPG-66
  • 4da6921 [MGPG-66] fix handling of excluded files on linux
  • 4016721 Merge pull request #12 from Syquel/bugfix/MGPG-80_equality
  • fba2c39 [MGPG-66] add test for handling of excluded files
  • 26aa5b3 [MGPG-66] fix handling of excluded files
  • 7438b37 [MGPG-80] implement GpgVersion equality in adherence to comparibility
  • b38c638 Merge pull request #11 from Syquel/bugfix/MGPG-80
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.apache.maven.plugins:maven-gpg-plugin&package-manager=maven&previous-version=1.4&new-version=3.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) 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) ---
Dependabot commands and options
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)
Fixes #714 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/714 from google:dependabot/maven/org.apache.maven.plugins-maven-gpg-plugin-3.0.1 f73393d9c2bb197b62eb5d776616b59573a06aaa PiperOrigin-RevId: 423801739 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 894b9dd6..3112ee7f 100644 --- a/pom.xml +++ b/pom.xml @@ -180,7 +180,7 @@
maven-gpg-plugin - 1.4 + 3.0.1 org.apache.felix @@ -338,7 +338,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + 3.0.1 sign-artifacts From 49eba6d05fd5220aa832b1034491c4ab0310dd21 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jan 2022 06:44:21 -0800 Subject: [PATCH 18/44] Bump truth.version from 1.0 to 1.1.3 Bumps `truth.version` from 1.0 to 1.1.3. Updates `truth` from 1.0 to 1.1.3
Release notes

Sourced from truth's releases.

1.1.3

  • Fixed a bug in how comparingExpectedFieldsOnly() handles oneof fields. (f27208428)
  • Improved comparingExpectedFieldsOnly to work when required fields are absent. (f27208428)
  • Changed Subject.toString() to throw UnsupportedOperationException. (fa4c7b512)

1.1.2

This release completes the feature that I got wrong in 1.1.1 -- the ability to exclude our JUnit 4 dependency and still use standard Truth assertions.

  • Made it possible for users to exclude our JUnit 4 dependency and still use standard Truth assertions -- really this time, even in cases in which excluding the dependency failed under 1.1.1. (JUnit 4 is still required for some advanced features, like Expect, ExpectFailure, and TruthJUnit.assume().) (948f3edca)
  • When JUnit 4 is excluded from the classpath, the AssertionError Truth generates as a substitute for ComparisonFailure now includes the expected and actual values that were missing in 1.1.1. (6b0140730)

1.1.1

We recommend not trying to exclude our JUnit dependency even under this release. We will release 1.1.2 with better handling for the missing dependency shortly.

  • Made it possible for users to exclude our JUnit 4 dependency and still use standard Truth assertions. (JUnit 4 is still required for some advanced features, like Expect, ExpectFailure, and TruthJUnit.assume().) (2d65326ec)
    • Update: This appears to let users exclude the dependency in some cases but not all. We are working on a fix.
    • Update 2: Also, even if you succeed in excluding the dependency in your environment, you will see failure messages that are missing information. We have a fix for this ready.

If you wish to exclude our JUnit dependency, you may wish to consider this alternative approach. That approach may be worthwhile even after we fix the bugs described above.

I apologize for the trouble.

1.1

  • Fixed (we think :)) R8 compilation failure: Error: com.android.tools.r8.errors.b: Compilation can't be completed because `org.objectweb.asm.ClassVisitor` and 1 other classes are missing. (0bfa285fa)
  • Added unpackingAnyUsing(TypeRegistry, ExtensionRegistry). If you call this method, ProtoTruth will attempt to unpack Any messages before comparing them. (b50d878b)
  • Added formattingDiffsUsing methods to IterableSubject and MapSubject. This allows you to get failure messages which show diffs between the actual and expected elements (like you get with comparingElementsUsing) while still comparing them using object equality. (ae997be77)
  • Changed Checker Framework annotations from checker-qual to qual. (e71b57b9f) With this change, we inadvertently introduced Java 8 bytecode into our dependencies. Please report problems on #882. Sorry for the trouble.
  • Added null checks to StringSubject. (3481ab0af)
  • Included ASM as a dependency (non-<optional>) by default. It is still safe to exclude if you want to minimize dependencies, but by including it, you may see better failure messages. (aea78e81c)
  • Removed dependency on []-user. (b54e9ef50fe670bf93dd3b2b6851423be631b429)
  • API documentation for Truth classes is now easier to reach. For example, for StringSubject, visit truth.dev/StringSubject. Also, more easily access the index at truth.dev/api.

1.0.1

  • Changed failure messages to identify trailing whitespace in failed string comparisons. (7a58a45b)
  • Moved []-user to test scope. (51bbbf42)
  • Fixed handling of proto maps with keys equal to the key type's default value. (8ebfe2ab)
  • Worked around what seems to be a classloading bug in old versions of some vendors' Android runtimes. (02c5e79925d455331377f3e6640cc450aecf6774)
Commits

Updates `truth-java8-extension` from 1.0 to 1.1.3 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) ---
Dependabot commands and options
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)
Fixes #720 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/720 from google:dependabot/maven/truth.version-1.1.3 8916bd632c588d87908f4d62e4aed99022004dc0 PiperOrigin-RevId: 423801861 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3112ee7f..231f4962 100644 --- a/pom.xml +++ b/pom.xml @@ -91,7 +91,7 @@ UTF-8 1.8 30.1.1-jre - 1.0 + 1.1.3 3.21.1 2.10.0 1.8.2 From 621fb85a8de8000fd80ced515828789cc45ff037 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Mon, 24 Jan 2022 08:14:36 -0800 Subject: [PATCH 19/44] Handle modifiers that start with `non-` Fixes https://github.com/google/google-java-format/issues/696 PiperOrigin-RevId: 423819018 --- .../java/JavaInputAstVisitor.java | 18 ++++++++++-------- .../java/FormatterIntegrationTest.java | 2 +- .../googlejavaformat/java/testdata/I696.input | 11 +++++++++++ .../googlejavaformat/java/testdata/I696.output | 8 ++++++++ 4 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 core/src/test/resources/com/google/googlejavaformat/java/testdata/I696.input create mode 100644 core/src/test/resources/com/google/googlejavaformat/java/testdata/I696.output diff --git a/core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java b/core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java index 8da71956..daed2502 100644 --- a/core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java +++ b/core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java @@ -2294,7 +2294,7 @@ private ImmutableList visitModifiers( ? forceBreakList(declarationAnnotationBreak) : breakList(declarationAnnotationBreak)); } - formatAnnotationOrModifier(declarationModifiers.removeFirst()); + formatAnnotationOrModifier(declarationModifiers); first = false; lastWasAnnotation = true; } @@ -2317,7 +2317,7 @@ private ImmutableList visitModifiers( if (!first) { builder.addAll(breakFillList(Optional.empty())); } - formatAnnotationOrModifier(declarationModifiers.removeFirst()); + formatAnnotationOrModifier(declarationModifiers); first = false; } builder.close(); @@ -2452,10 +2452,15 @@ DeclarationModifiersAndTypeAnnotations splitModifiers( modifiers.subList(0, idx + 1), typeAnnotations.build().reverse()); } - private void formatAnnotationOrModifier(AnnotationOrModifier modifier) { + private void formatAnnotationOrModifier(Deque modifiers) { + AnnotationOrModifier modifier = modifiers.removeFirst(); switch (modifier.getKind()) { case MODIFIER: token(modifier.modifier().getText()); + if (modifier.modifier().getText().equals("non")) { + token(modifiers.removeFirst().modifier().getText()); + token(modifiers.removeFirst().modifier().getText()); + } break; case ANNOTATION: scan(modifier.annotation(), null); @@ -2471,10 +2476,6 @@ boolean isTypeAnnotation(AnnotationTree annotationTree) { return typeAnnotationSimpleNames.contains(((IdentifierTree) annotationType).getName()); } - boolean nextIsModifier() { - return isModifier(builder.peekToken().get()); - } - private static boolean isModifier(String token) { switch (token) { case "public": @@ -2490,7 +2491,8 @@ private static boolean isModifier(String token) { case "strictfp": case "default": case "sealed": - case "non-sealed": + case "non": + case "-": return true; default: return false; diff --git a/core/src/test/java/com/google/googlejavaformat/java/FormatterIntegrationTest.java b/core/src/test/java/com/google/googlejavaformat/java/FormatterIntegrationTest.java index 22202e98..61a43468 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/FormatterIntegrationTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/FormatterIntegrationTest.java @@ -51,7 +51,7 @@ public class FormatterIntegrationTest { .putAll(14, "I477", "Records", "RSLs", "Var", "ExpressionSwitch", "I574", "I594") .putAll(15, "I603") .putAll(16, "I588") - .putAll(17, "I683", "I684") + .putAll(17, "I683", "I684", "I696") .build(); @Parameters(name = "{index}: {0}") diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/I696.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I696.input new file mode 100644 index 00000000..156e6efc --- /dev/null +++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I696.input @@ -0,0 +1,11 @@ +public abstract non-sealed class A extends SealedClass { +} + +non-sealed class B extends SealedClass { +} + +non-sealed @A class B extends SealedClass { +} + +@A non-sealed class B extends SealedClass { +} diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/I696.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I696.output new file mode 100644 index 00000000..14721c37 --- /dev/null +++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I696.output @@ -0,0 +1,8 @@ +public abstract non-sealed class A extends SealedClass {} + +non-sealed class B extends SealedClass {} + +non-sealed @A class B extends SealedClass {} + +@A +non-sealed class B extends SealedClass {} From 3de0712022506bb22aa7e89a7cbd25912696bf37 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jan 2022 10:21:53 -0800 Subject: [PATCH 20/44] Bump auto-service-annotations from 1.0 to 1.0.1 Bumps [auto-service-annotations](https://github.com/google/auto) from 1.0 to 1.0.1.
Release notes

Sourced from auto-service-annotations's releases.

AutoFactory 1.0.1

  • Fixed Gradle incremental compilation. (8f17e4c4)

AutoCommon 1.0.1

  • Added some methods to allow annotation processors to use Streams functionality that is present in mainline Guava but not Android Guava. This can be useful if Android Guava might be on the processor path.

AutoService 1.0.1

  • AutoService no longer throws an exception for a missing service class. (d8083fde)
  • Fixed a bug in AutoServiceProcessor that could lead to some services not being processed. (d4c865be)
Commits
  • e057b8b Set version number for auto-common to 1.0.1.
  • 15d49d9 Replace server Guava API usage with Android compatible alternatives.
  • 64b9ecc Bump actions/cache from 2.1.5 to 2.1.6
  • 7d3aa66 Implicitly exclude Kotlin @Metadata annotations from @CopyAnnotations
  • 2b77e44 Bump kotlin.version from 1.5.0 to 1.5.10 in /value
  • acb0765 Bump truth from 1.1.2 to 1.1.3 in /factory
  • 7f8bd35 Bump truth from 1.1.2 to 1.1.3 in /common
  • d482097 Bump truth from 1.1.2 to 1.1.3 in /service
  • 31eeb67 Bump truth.version from 1.1.2 to 1.1.3 in /value
  • 54baeb3 Update an AutoValue test to the newer compile-testing API.
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.auto.service:auto-service-annotations&package-manager=maven&previous-version=1.0&new-version=1.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) 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) ---
Dependabot commands and options
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)
Fixes #724 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/724 from google:dependabot/maven/com.google.auto.service-auto-service-annotations-1.0.1 f73ae20a8d349ad0cf51c047cac205a5954e0a97 PiperOrigin-RevId: 423849278 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 231f4962..0b3df529 100644 --- a/pom.xml +++ b/pom.xml @@ -95,7 +95,7 @@ 3.21.1 2.10.0 1.8.2 - 1.0 + 1.0.1 3.1.0 3.2.1 From fa48f487494ce22c12210902a8b13e18e6c253e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jan 2022 11:50:46 -0800 Subject: [PATCH 21/44] Bump maven-compiler-plugin from 3.7.0 to 3.9.0 Bumps [maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.7.0 to 3.9.0.
Commits
  • aeb15b6 [maven-release-plugin] prepare release maven-compiler-plugin-3.9.0
  • 6335382 Shared GitHub Acton v2
  • 8d5d3cd Fix site build
  • ce4eb1e Bump plexus-component-metadata from 2.1.0 to 2.1.1
  • f875750 Bump mockito-core from 4.1.0 to 4.2.0
  • 5463357 fix CI site goal
  • 859c903 Update plugins
  • b0de9bc Bump mockito-core from 4.0.0 to 4.1.0
  • f95dd46 Bump plexusCompilerVersion from 2.8.8 to 2.9.0
  • 26900cf Bump mockito-core from 2.28.2 to 4.0.0
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.apache.maven.plugins:maven-compiler-plugin&package-manager=maven&previous-version=3.7.0&new-version=3.9.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) 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) ---
Dependabot commands and options
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)
Fixes #725 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/725 from google:dependabot/maven/org.apache.maven.plugins-maven-compiler-plugin-3.9.0 d8cdb3fd6ae508b7311981da10875797bc57c725 PiperOrigin-RevId: 423873405 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0b3df529..fab2146d 100644 --- a/pom.xml +++ b/pom.xml @@ -164,7 +164,7 @@ maven-compiler-plugin - 3.7.0 + 3.9.0 maven-jar-plugin From d52e308814a04a5f0a0c3e4b46f73acdee77b089 Mon Sep 17 00:00:00 2001 From: Derek Perez Date: Thu, 27 Jan 2022 13:23:59 -0800 Subject: [PATCH 22/44] GraalVM native-image Maven build support Closes #358. This appears to work as expected. I have a [weird case](https://github.com/oracle/graal/discussions/4254) I'm not really sure how to address (the need to specify -Djava.home during execution), but otherwise, this produces a fully static binary that is very fast and works. To execute the build, you run the following command: ``` mvn -Pnative -DskipTests package ``` Fixes #728 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/728 from perezd:native-image 9b64d0770418601b5a4e82ab6d52bbfca993c87e PiperOrigin-RevId: 424692716 --- core/pom.xml | 39 +++++++++++++++++++ .../META-INF/native-image/reflect-config.json | 6 +++ 2 files changed, 45 insertions(+) create mode 100644 core/src/main/resources/META-INF/native-image/reflect-config.json diff --git a/core/pom.xml b/core/pom.xml index 39b9a3d9..718385d7 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -249,5 +249,44 @@ + + native + + + + org.graalvm.buildtools + native-maven-plugin + 0.9.9 + true + + + build-native + + build + + package + + + test-native + + test + + test + + + + google-java-format + + ${project.build.directory}/${project.artifactId}-${project.version}-all-deps.jar + + + -H:IncludeResourceBundles=com.sun.tools.javac.resources.compiler + --no-fallback + + + + + + diff --git a/core/src/main/resources/META-INF/native-image/reflect-config.json b/core/src/main/resources/META-INF/native-image/reflect-config.json new file mode 100644 index 00000000..2c658034 --- /dev/null +++ b/core/src/main/resources/META-INF/native-image/reflect-config.json @@ -0,0 +1,6 @@ +[ + { + "name": "com.sun.tools.javac.parser.UnicodeReader", + "allDeclaredMethods": true + } +] From 0198230882db1c122078d5b8a9b1286f408c2ac5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Jan 2022 07:34:11 -0800 Subject: [PATCH 23/44] Bump error_prone_annotations from 2.10.0 to 2.11.0 Bumps [error_prone_annotations](https://github.com/google/error-prone) from 2.10.0 to 2.11.0.
Release notes

Sourced from error_prone_annotations's releases.

Error Prone 2.11.0

Error Prone now requires JDK 11 or newer (google/error-prone#2730).

New checks

Fixed issues: #2641, #2705, #2776, #2798, #2799, #2819, #2820, #2831, #2833, #2834, #2835, #2861, #2873, #2889, #2892, #2901

Full Changelog: https://github.com/google/error-prone/compare/v2.10.0...v2.11.0

Commits
  • 6439153 Release Error Prone 2.11.0
  • d33ab70 Add backreferences to b/216306810
  • 3f61879 Decrease TooManyParameters default limit from 10 to 9.
  • c2e14f2 Make ASTHelpers.getSymbol(MethodInvocationTree) and friends throw instead o...
  • c18ae52 Autofix all the AnnotationPosition findings in EP.
  • 4698c8e intellij project files update
  • f6a508f Bump more deps.
  • 048a664 Document missing itself lock expression.
  • fbaa55b Update OrphanedFormatString to warn on log("hello %s")
  • e09ca6f More version updates
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.errorprone:error_prone_annotations&package-manager=maven&previous-version=2.10.0&new-version=2.11.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) 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) ---
Dependabot commands and options
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)
Fixes #729 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/729 from google:dependabot/maven/com.google.errorprone-error_prone_annotations-2.11.0 77a2bb8cc92c18539ccdc47aa6d235571df32df4 PiperOrigin-RevId: 424866054 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fab2146d..95fb8f68 100644 --- a/pom.xml +++ b/pom.xml @@ -93,7 +93,7 @@ 30.1.1-jre 1.1.3 3.21.1 - 2.10.0 + 2.11.0 1.8.2 1.0.1 3.1.0 From 16e72a1a9bbf182fac6686807e54bc846a9543ed Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Fri, 28 Jan 2022 08:43:12 -0800 Subject: [PATCH 24/44] Treat single-character upper case identifiers as UpperCamelCase as a concession to Android `R` classes. PiperOrigin-RevId: 424878859 --- .../com/google/googlejavaformat/java/TypeNameClassifier.java | 2 +- .../google/googlejavaformat/java/TypeNameClassifierTest.java | 2 ++ .../google/googlejavaformat/java/testdata/b26306390.input | 3 +++ .../google/googlejavaformat/java/testdata/b26306390.output | 5 +++++ 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 core/src/test/resources/com/google/googlejavaformat/java/testdata/b26306390.input create mode 100644 core/src/test/resources/com/google/googlejavaformat/java/testdata/b26306390.output diff --git a/core/src/main/java/com/google/googlejavaformat/java/TypeNameClassifier.java b/core/src/main/java/com/google/googlejavaformat/java/TypeNameClassifier.java index 4e871a67..21fae5f0 100644 --- a/core/src/main/java/com/google/googlejavaformat/java/TypeNameClassifier.java +++ b/core/src/main/java/com/google/googlejavaformat/java/TypeNameClassifier.java @@ -164,7 +164,7 @@ static JavaCaseFormat from(String name) { hasLowercase |= Character.isLowerCase(c); } if (firstUppercase) { - return hasLowercase ? UPPER_CAMEL : UPPERCASE; + return (hasLowercase || name.length() == 1) ? UPPER_CAMEL : UPPERCASE; } else { return hasUppercase ? LOWER_CAMEL : LOWERCASE; } diff --git a/core/src/test/java/com/google/googlejavaformat/java/TypeNameClassifierTest.java b/core/src/test/java/com/google/googlejavaformat/java/TypeNameClassifierTest.java index 9d1e00a1..3270bc64 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/TypeNameClassifierTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/TypeNameClassifierTest.java @@ -43,6 +43,7 @@ public void caseFormat() throws Exception { assertThat(JavaCaseFormat.from("a_$")).isEqualTo(JavaCaseFormat.LOWERCASE); assertThat(JavaCaseFormat.from("_")).isEqualTo(JavaCaseFormat.LOWERCASE); assertThat(JavaCaseFormat.from("_A")).isEqualTo(JavaCaseFormat.UPPERCASE); + assertThat(JavaCaseFormat.from("A")).isEqualTo(JavaCaseFormat.UPPER_CAMEL); } private static Optional getPrefix(String qualifiedName) { @@ -62,6 +63,7 @@ public void typePrefixLength() { assertThat(getPrefix("ClassName.CONST")).hasValue(1); assertThat(getPrefix("ClassName.varName")).hasValue(1); assertThat(getPrefix("ClassName.Inner.varName")).hasValue(2); + assertThat(getPrefix("com.R.foo")).hasValue(2); } @Test diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/b26306390.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/b26306390.input new file mode 100644 index 00000000..da6c01b0 --- /dev/null +++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/b26306390.input @@ -0,0 +1,3 @@ +class B26306390 { + int resourceId = com.some.extremely.verbose.pkg.name.R.string.some_extremely_long_resource_identifier_that_exceeds_the_column_limit; +} diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/b26306390.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/b26306390.output new file mode 100644 index 00000000..a21772f8 --- /dev/null +++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/b26306390.output @@ -0,0 +1,5 @@ +class B26306390 { + int resourceId = + com.some.extremely.verbose.pkg.name.R.string + .some_extremely_long_resource_identifier_that_exceeds_the_column_limit; +} From f07691cdf6f035f1b9008b72dc3c52597ba7c553 Mon Sep 17 00:00:00 2001 From: Derek Perez Date: Fri, 28 Jan 2022 12:20:36 -0800 Subject: [PATCH 25/44] Defining basic structure. --- .github/workflows/release.yml | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..e3021e19 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: Release google-java-format + +on: + workflow_dispatch: + inputs: + version: + description: "version number for this release." + required: true + +env: + JAVA_HOME: "$JAVA_HOME_17_X64" + +jobs: + define-release: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Setup Signing Key + run: | + cat <(echo -e "${{ secrets.GPG_SIGNING_KEY }}") | gpg --batch --import + gpg --list-secret-keys --keyid-format LONG + + - name: Checkout + uses: actions/checkout@2.4.0 + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: 17 + distribution: 'zulu' + cache: 'maven' + + - name: Run Tests + run: mvn verify + + - name: Bump Version Number + env: + NEW_VERSION: ${{ github.events.input.version }} + run: | + mvn versions:set versions:commit -DnewVersion="${NEW_VERSION}" + git ls-files | grep 'pom.xml$' | xargs git add + git commit -m "Release google-java-format ${NEW_VERSION}" + git tag "v${NEW_VERSION}" + git push origin "v${NEW_VERSION}" + + - name: Create Maven Jars + run: mvn clean deploy + + - name: Define Release Entry + uses: softprops/action-gh-release@v1 + with: + draft: true + name: ${{ github.events.input.version }} + tag_name: "v${{ github.events.input.version }}" + From da0ad7f608eac6ca06fb15d128f21bad05a091a3 Mon Sep 17 00:00:00 2001 From: Derek Perez Date: Fri, 28 Jan 2022 12:22:09 -0800 Subject: [PATCH 26/44] rm custom JAVA_HOME env. --- .github/workflows/release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e3021e19..9eee6509 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,9 +7,6 @@ on: description: "version number for this release." required: true -env: - JAVA_HOME: "$JAVA_HOME_17_X64" - jobs: define-release: runs-on: ubuntu-latest From 9da00eb6046dd725cc124c50d04eda6ccebd0e12 Mon Sep 17 00:00:00 2001 From: Derek Perez Date: Fri, 28 Jan 2022 13:06:02 -0800 Subject: [PATCH 27/44] Update release.yml --- .github/workflows/release.yml | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9eee6509..689f3394 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,10 +8,10 @@ on: required: true jobs: - define-release: + build-maven-jars: runs-on: ubuntu-latest permissions: - contents: write + contents: read steps: - name: Setup Signing Key run: | @@ -20,17 +20,14 @@ jobs: - name: Checkout uses: actions/checkout@2.4.0 - + - name: Set up JDK uses: actions/setup-java@v2 with: java-version: 17 distribution: 'zulu' cache: 'maven' - - - name: Run Tests - run: mvn verify - + - name: Bump Version Number env: NEW_VERSION: ${{ github.events.input.version }} @@ -38,16 +35,15 @@ jobs: mvn versions:set versions:commit -DnewVersion="${NEW_VERSION}" git ls-files | grep 'pom.xml$' | xargs git add git commit -m "Release google-java-format ${NEW_VERSION}" - git tag "v${NEW_VERSION}" - git push origin "v${NEW_VERSION}" - - - name: Create Maven Jars - run: mvn clean deploy + git push + + - name: Build Jars + run: mvn clean verify gpg:sign -DskipTests=true -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" - - name: Define Release Entry + - name: Add Jars to Release Entry uses: softprops/action-gh-release@v1 with: draft: true name: ${{ github.events.input.version }} tag_name: "v${{ github.events.input.version }}" - + files: core/target/google-java-format-*.jar From f004493ab5af51d9d0ceea4c239527feff8c9047 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Mon, 31 Jan 2022 13:27:18 -0800 Subject: [PATCH 28/44] Stop hard-coding explicit versions in the README PiperOrigin-RevId: 425446891 --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index aa560505..5d1d7c7d 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ and run it with: ``` -java -jar /path/to/google-java-format-1.13.0-all-deps.jar [files...] +java -jar /path/to/google-java-format-${GJF_VERSION?}-all-deps.jar [files...] ``` The formatter can act on whole files, on limited lines (`--lines`), on specific @@ -39,7 +39,7 @@ java \ --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.13.0-all-deps.jar [files...] + -jar google-java-format-${GJF_VERSION?}-all-deps.jar [files...] ``` ### IntelliJ, Android Studio, and other JetBrains IDEs @@ -70,9 +70,9 @@ and import it into File→Settings→Editor→Code Style. ### Eclipse -Version 1.11 of the -[google-java-format Eclipse plugin](https://github.com/google/google-java-format/releases/download/v1.13.0/google-java-format-eclipse-plugin-1.13.0.jar) -can be downloaded from the releases page. Drop it into the Eclipse +The latest version of the `google-java-format` Eclipse plugin can be downloaded +from the [releases page](https://github.com/google/google-java-format/releases). +Drop it into the Eclipse [drop-ins folder](http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fp2_dropins_format.html) to activate the plugin. @@ -113,7 +113,7 @@ configuration. com.google.googlejavaformat google-java-format - 1.13.0 + ${google-java-format.version} ``` @@ -121,7 +121,7 @@ configuration. ```groovy dependencies { - implementation 'com.google.googlejavaformat:google-java-format:1.13.0' + implementation 'com.google.googlejavaformat:google-java-format:$googleJavaFormatVersion' } ``` From 94bedf4e2194716d2df059218aeb3d042247b735 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Mon, 31 Jan 2022 13:43:32 -0800 Subject: [PATCH 29/44] Pass `--initialize-at-build-time=com.sun.tools.javac.file.Locations` to native image build to work around https://github.com/oracle/graal/discussions/4254 PiperOrigin-RevId: 425451233 --- core/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/core/pom.xml b/core/pom.xml index 718385d7..1d471595 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -282,6 +282,7 @@ -H:IncludeResourceBundles=com.sun.tools.javac.resources.compiler --no-fallback + --initialize-at-build-time=com.sun.tools.javac.file.Locations
From 668f108de438db15158d33ed1a386bdbab3b4d09 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Mon, 31 Jan 2022 13:44:08 -0800 Subject: [PATCH 30/44] Don't use single-line for for javadoc without a summary fragment Roll forward of https://github.com/google/google-java-format/commit/06a2105be2d73bbbdc6cb6f8dc43f84e2eb00e07 Using the multi-line form here may call attention to the missing summary fragment. The style guide can also be read as discouraging the single-line form for non-required javadoc missing a summary fragment (see b/74239048#comment4), but I'm not sure that's the intent, and I'm looking at changing it (unknown commit). PiperOrigin-RevId: 425451391 --- .../java/javadoc/JavadocFormatter.java | 25 +++++++++++--- .../java/JavadocFormattingTest.java | 33 ++++++++++++++++++- 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/com/google/googlejavaformat/java/javadoc/JavadocFormatter.java b/core/src/main/java/com/google/googlejavaformat/java/javadoc/JavadocFormatter.java index 5addc677..03938a67 100644 --- a/core/src/main/java/com/google/googlejavaformat/java/javadoc/JavadocFormatter.java +++ b/core/src/main/java/com/google/googlejavaformat/java/javadoc/JavadocFormatter.java @@ -166,15 +166,30 @@ private static Token standardize(Token token, Token standardToken) { * fits on one line. */ private static String makeSingleLineIfPossible(int blockIndent, String input) { - int oneLinerContentLength = MAX_LINE_LENGTH - "/** */".length() - blockIndent; Matcher matcher = ONE_CONTENT_LINE_PATTERN.matcher(input); - if (matcher.matches() && matcher.group(1).isEmpty()) { - return "/** */"; - } else if (matcher.matches() && matcher.group(1).length() <= oneLinerContentLength) { - return "/** " + matcher.group(1) + " */"; + if (matcher.matches()) { + String line = matcher.group(1); + if (line.isEmpty()) { + return "/** */"; + } else if (oneLineJavadoc(line, blockIndent)) { + return "/** " + line + " */"; + } } return input; } + private static boolean oneLineJavadoc(String line, int blockIndent) { + int oneLinerContentLength = MAX_LINE_LENGTH - "/** */".length() - blockIndent; + if (line.length() > oneLinerContentLength) { + return false; + } + // If the javadoc contains only a tag, use multiple lines to encourage writing a summary + // fragment, unless it's /* @hide */. + if (line.startsWith("@") && !line.equals("@hide")) { + return false; + } + return true; + } + private JavadocFormatter() {} } diff --git a/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java b/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java index f5103d9b..6849c01f 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java @@ -937,7 +937,9 @@ public void onlyParams() { "class Test {}", }; String[] expected = { - "/** @param this is a param */", // + "/**", // + " * @param this is a param", + " */", "class Test {}", }; doFormatTest(input, expected); @@ -1415,4 +1417,33 @@ public void u2028LineSeparator() { }; doFormatTest(input, expected); } + + @Test + public void missingSummaryFragment() { + String[] input = { + "public class Foo {", + " /**", + " * @return something.", + " */", + " public void setSomething() {}", + "", + " /**", + " * @hide", + " */", + " public void setSomething() {}", + "}", + }; + String[] expected = { + "public class Foo {", + " /**", + " * @return something.", + " */", + " public void setSomething() {}", + "", + " /** @hide */", + " public void setSomething() {}", + "}", + }; + doFormatTest(input, expected); + } } From 05c5649ff1549d07be1c9557715a2bf267c5440c Mon Sep 17 00:00:00 2001 From: Derek Perez Date: Mon, 31 Jan 2022 14:35:02 -0800 Subject: [PATCH 31/44] Maven artifacts + GitHub Release page automation Fixes #733 PiperOrigin-RevId: 425464073 --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 38 ++++++++++++++++++++++------------- eclipse_plugin/pom.xml | 2 +- pom.xml | 3 --- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e15d01cd..a1da280c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest ] - java: [ 17, 14, 11 ] + java: [ 17, 11 ] experimental: [ false ] include: # Only test on macos and windows with a single recent JDK to avoid a diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 689f3394..08619cd8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,39 +11,49 @@ jobs: build-maven-jars: runs-on: ubuntu-latest permissions: - contents: read + contents: write steps: - name: Setup Signing Key run: | - cat <(echo -e "${{ secrets.GPG_SIGNING_KEY }}") | gpg --batch --import + gpg-agent --daemon --default-cache-ttl 7200 + echo -e "${{ secrets.GPG_SIGNING_KEY }}" | gpg --batch --import --no-tty + echo "hello world" > temp.txt + gpg --detach-sig --yes -v --output=/dev/null --pinentry-mode loopback --passphrase "${{ secrets.GPG_PASSPHRASE }}" temp.txt + rm temp.txt gpg --list-secret-keys --keyid-format LONG - name: Checkout - uses: actions/checkout@2.4.0 + uses: actions/checkout@v2.4.0 - name: Set up JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v2.5.0 with: java-version: 17 distribution: 'zulu' cache: 'maven' - name: Bump Version Number - env: - NEW_VERSION: ${{ github.events.input.version }} run: | - mvn versions:set versions:commit -DnewVersion="${NEW_VERSION}" + mvn --no-transfer-progress versions:set versions:commit -DnewVersion="${{ github.event.inputs.version }}" + mvn tycho-versions:update-eclipse-metadata -pl eclipse_plugin git ls-files | grep 'pom.xml$' | xargs git add - git commit -m "Release google-java-format ${NEW_VERSION}" + git config --global user.email "${{ github.actor }}@users.noreply.github.com" + git config --global user.name "${{ github.actor }}" + git commit -m "Release google-java-format ${{ github.event.inputs.version }}" + echo "TARGET_COMMITISH=$(git rev-parse HEAD)" >> $GITHUB_ENV + git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/google/google-java-format.git git push - + - name: Build Jars - run: mvn clean verify gpg:sign -DskipTests=true -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" + run: mvn --no-transfer-progress clean verify gpg:sign -DskipTests=true -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" - name: Add Jars to Release Entry - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v0.1.14 with: draft: true - name: ${{ github.events.input.version }} - tag_name: "v${{ github.events.input.version }}" - files: core/target/google-java-format-*.jar + name: ${{ github.event.input.version }} + tag_name: "v${{ github.event.inputs.version }}" + target_commitish: ${{ env.TARGET_COMMITISH }} + files: | + core/target/google-java-format-*.jar + eclipse_plugin/target/google-java-format-eclipse-plugin-*.jar diff --git a/eclipse_plugin/pom.xml b/eclipse_plugin/pom.xml index ee5635c4..bf3ef3d6 100644 --- a/eclipse_plugin/pom.xml +++ b/eclipse_plugin/pom.xml @@ -32,7 +32,7 @@ UTF-8 - 1.7.0 + 2.6.0 diff --git a/pom.xml b/pom.xml index 95fb8f68..5d768de7 100644 --- a/pom.xml +++ b/pom.xml @@ -27,10 +27,7 @@ core - Google Java Format Parent From 69799747b38ad42bf51ad4c2e67f2f8a12bd8a17 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Mon, 31 Jan 2022 16:13:11 -0800 Subject: [PATCH 32/44] Update release.yml Try to only push the new tag --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 08619cd8..7bf270ba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,7 +42,7 @@ jobs: git commit -m "Release google-java-format ${{ github.event.inputs.version }}" echo "TARGET_COMMITISH=$(git rev-parse HEAD)" >> $GITHUB_ENV git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/google/google-java-format.git - git push + git push origin "${{ github.event.inputs.version }}" - name: Build Jars run: mvn --no-transfer-progress clean verify gpg:sign -DskipTests=true -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" From f72191b67add34474644e6eb65b4b5295e1b8446 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Mon, 31 Jan 2022 16:26:49 -0800 Subject: [PATCH 33/44] Update release.yml Tag release commits --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7bf270ba..2c5315d9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,9 +40,10 @@ jobs: git config --global user.email "${{ github.actor }}@users.noreply.github.com" git config --global user.name "${{ github.actor }}" git commit -m "Release google-java-format ${{ github.event.inputs.version }}" + git tag "v${{ github.event.inputs.version }}" echo "TARGET_COMMITISH=$(git rev-parse HEAD)" >> $GITHUB_ENV git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/google/google-java-format.git - git push origin "${{ github.event.inputs.version }}" + git push origin "v${{ github.event.inputs.version }}" - name: Build Jars run: mvn --no-transfer-progress clean verify gpg:sign -DskipTests=true -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" From 4c649342725460d08f7a14d3c5033f0b099d9dbd Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Mon, 31 Jan 2022 16:37:30 -0800 Subject: [PATCH 34/44] Update ci.yml Use JDK 17 to build snapshots --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1da280c..033cf2da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,10 +73,10 @@ jobs: steps: - name: 'Check out repository' uses: actions/checkout@v2 - - name: 'Set up JDK 15' + - name: 'Set up JDK 17' uses: actions/setup-java@v2 with: - java-version: 15 + java-version: 17 distribution: 'zulu' cache: 'maven' server-id: sonatype-nexus-snapshots From 9d2225aafabb1cc4c3c4e4f496decd9ee10e07b8 Mon Sep 17 00:00:00 2001 From: Kurt Alfred Kluever Date: Tue, 1 Feb 2022 09:32:46 -0800 Subject: [PATCH 35/44] Automatic code cleanup. PiperOrigin-RevId: 425644626 --- .../main/java/com/google/googlejavaformat/java/JavaInput.java | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/google/googlejavaformat/java/JavaInput.java b/core/src/main/java/com/google/googlejavaformat/java/JavaInput.java index e671ad01..165bdebb 100644 --- a/core/src/main/java/com/google/googlejavaformat/java/JavaInput.java +++ b/core/src/main/java/com/google/googlejavaformat/java/JavaInput.java @@ -311,7 +311,7 @@ private static ImmutableMap makePositionToColumnMap(List for (Tok tok : toks) { builder.put(tok.getPosition(), tok.getColumn()); } - return builder.build(); + return builder.buildOrThrow(); } /** diff --git a/pom.xml b/pom.xml index 5d768de7..5ea3c3b3 100644 --- a/pom.xml +++ b/pom.xml @@ -87,7 +87,7 @@ UTF-8 1.8 - 30.1.1-jre + 31.0.1-jre 1.1.3 3.21.1 2.11.0 From 0c95c8f635cf4acc42a020382229dbf8ca0cb2ef Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Tue, 1 Feb 2022 10:08:22 -0800 Subject: [PATCH 36/44] Update ci.yml Skip the eclipse plugin for snapshot builds --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 033cf2da..016b8e77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,4 +86,4 @@ jobs: env: CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }} - run: mvn source:jar deploy -B -DskipTests=true -Dinvoker.skip=true -Dmaven.javadoc.skip=true + run: mvn -pl '!eclipse_plugin' source:jar deploy -B -DskipTests=true -Dinvoker.skip=true -Dmaven.javadoc.skip=true From 304bb7184a105e0029baae38108319e59631b614 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Wed, 2 Feb 2022 13:45:03 -0800 Subject: [PATCH 37/44] Update dependabot.yml Stop updating github-actions --- .github/dependabot.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b76b8957..daec3189 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,7 +4,3 @@ updates: directory: "/" schedule: interval: "daily" - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "daily" From af804c68b8f2bd790e1a0a0848b6c74a519ed975 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Wed, 2 Feb 2022 16:52:08 -0800 Subject: [PATCH 38/44] Update versions PiperOrigin-RevId: 426010942 --- eclipse_plugin/pom.xml | 2 +- pom.xml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eclipse_plugin/pom.xml b/eclipse_plugin/pom.xml index bf3ef3d6..534e685f 100644 --- a/eclipse_plugin/pom.xml +++ b/eclipse_plugin/pom.xml @@ -56,7 +56,7 @@ org.apache.maven.plugins maven-dependency-plugin - 3.1.2 + 3.2.0 copy-dependencies diff --git a/pom.xml b/pom.xml index 5ea3c3b3..1f3855b8 100644 --- a/pom.xml +++ b/pom.xml @@ -91,9 +91,9 @@ 1.1.3 3.21.1 2.11.0 - 1.8.2 + 1.9 1.0.1 - 3.1.0 + 3.3.1 3.2.1 @@ -173,7 +173,7 @@
maven-javadoc-plugin - 3.2.0 + 3.3.1 maven-gpg-plugin @@ -182,7 +182,7 @@ org.apache.felix maven-bundle-plugin - 2.4.0 + 5.1.4 @@ -251,7 +251,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.2.0 + 3.3.1 none From d86e930de93f123994fba151a8d289b8035db87b Mon Sep 17 00:00:00 2001 From: Zakaria Elkatani Date: Fri, 4 Feb 2022 14:23:19 -0800 Subject: [PATCH 39/44] Make some best-practices changes to the plugin. Since the last plugin update was almost half a year ago, I thought it would be prudent to update it and resolve most of the issues regarding updating the plugin. It took around half an hour once I managed to correctly set up the module due to the gradle plugin version 1.2.1 + intellij version 2020.3 requiring java 11 to develop. All of the included annotation changes were requested by IntelliJ to add since the overrides added them as well. The change of `` to `` was to resolve the syntax errors introduced by a change removing the wildcard requirement. NotificationGroup was deprecated and moved into the plugin xml file as per the SDK docs The same was required for `StdFileTypes.JAVA` being deprecated with the fix being `JavaFileType.INSTANCE` + changing the depend module to add that fix. I had to change the project SDK to JDK 11 on my end to have the gradle build work. I also tested the plugin with 1.12 and 1.10 on some test files such as from #653 and #654. Would be good to have some double checking though because I've had issues trying to get the test file reformatted in #558 working. Probably because it's locked behind an experimental flag? Fixes #688 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/688 from ze:idea-1.12.0 53f216cd030a553c8200c75606168de0a8039e1a PiperOrigin-RevId: 426491735 --- idea_plugin/.gitignore | 5 ++ idea_plugin/build.gradle | 24 ++++---- idea_plugin/resources/META-INF/plugin.xml | 24 +++++--- .../intellij/CodeStyleManagerDecorator.java | 57 +++++++++++-------- .../intellij/FormatterUtil.java | 3 +- .../GoogleJavaFormatCodeStyleManager.java | 24 ++++---- .../intellij/GoogleJavaFormatSettings.java | 7 ++- ...alConfigurationProjectManagerListener.java | 5 +- 8 files changed, 87 insertions(+), 62 deletions(-) create mode 100644 idea_plugin/.gitignore diff --git a/idea_plugin/.gitignore b/idea_plugin/.gitignore new file mode 100644 index 00000000..16bc65a5 --- /dev/null +++ b/idea_plugin/.gitignore @@ -0,0 +1,5 @@ +build +.gradle +gradle +gradlew +gradlew.bat \ No newline at end of file diff --git a/idea_plugin/build.gradle b/idea_plugin/build.gradle index 36c12f13..d9f769d4 100644 --- a/idea_plugin/build.gradle +++ b/idea_plugin/build.gradle @@ -15,7 +15,7 @@ */ plugins { - id "org.jetbrains.intellij" version "1.3.0" + id "org.jetbrains.intellij" version "1.3.1" } repositories { @@ -23,23 +23,27 @@ repositories { } ext { - googleJavaFormatVersion = '1.13.0' + googleJavaFormatVersion = "1.13.0" } -apply plugin: 'org.jetbrains.intellij' -apply plugin: 'java' +apply plugin: "org.jetbrains.intellij" +apply plugin: "java" + +sourceCompatibility = JavaVersion.VERSION_11 +targetCompatibility = JavaVersion.VERSION_11 intellij { pluginName = "google-java-format" - version = "IC-213.5744.18-EAP-SNAPSHOT" + plugins = ["java"] + version = "221.3427-EAP-CANDIDATE-SNAPSHOT" } patchPluginXml { pluginDescription = "Formats source code using the google-java-format tool. This version of " + "the plugin uses version ${googleJavaFormatVersion} of the tool." - version = "${googleJavaFormatVersion}.0" - sinceBuild = '201' - untilBuild = '' + version.set("${googleJavaFormatVersion}.0") + sinceBuild = "203" + untilBuild = "" } publishPlugin { @@ -48,8 +52,8 @@ publishPlugin { sourceSets { main { - java.srcDir 'src' - resources.srcDir 'resources' + java.srcDir "src" + resources.srcDir "resources" } } diff --git a/idea_plugin/resources/META-INF/plugin.xml b/idea_plugin/resources/META-INF/plugin.xml index 60705902..f10cde5a 100644 --- a/idea_plugin/resources/META-INF/plugin.xml +++ b/idea_plugin/resources/META-INF/plugin.xml @@ -14,7 +14,8 @@ limitations under the License. --> - + google-java-format google-java-format @@ -24,7 +25,7 @@ - com.intellij.modules.lang + com.intellij.java @@ -58,17 +59,22 @@ ]]> - + + topic="com.intellij.openapi.project.ProjectManagerListener"/> - - + + + diff --git a/idea_plugin/src/com/google/googlejavaformat/intellij/CodeStyleManagerDecorator.java b/idea_plugin/src/com/google/googlejavaformat/intellij/CodeStyleManagerDecorator.java index fc335ad6..af5da957 100644 --- a/idea_plugin/src/com/google/googlejavaformat/intellij/CodeStyleManagerDecorator.java +++ b/idea_plugin/src/com/google/googlejavaformat/intellij/CodeStyleManagerDecorator.java @@ -34,10 +34,11 @@ import com.intellij.util.ThrowableRunnable; import java.util.Collection; import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; /** * Decorates the {@link CodeStyleManager} abstract class by delegating to a concrete implementation - * instance (likely IJ's default instance). + * instance (likely IntelliJ's default instance). */ @SuppressWarnings("deprecation") class CodeStyleManagerDecorator extends CodeStyleManager @@ -54,98 +55,102 @@ CodeStyleManager getDelegate() { } @Override - public Project getProject() { + public @NotNull Project getProject() { return delegate.getProject(); } @Override - public PsiElement reformat(PsiElement element) throws IncorrectOperationException { + public @NotNull PsiElement reformat(@NotNull PsiElement element) + throws IncorrectOperationException { return delegate.reformat(element); } @Override - public PsiElement reformat(PsiElement element, boolean canChangeWhiteSpacesOnly) + public @NotNull PsiElement reformat(@NotNull PsiElement element, boolean canChangeWhiteSpacesOnly) throws IncorrectOperationException { return delegate.reformat(element, canChangeWhiteSpacesOnly); } @Override - public PsiElement reformatRange(PsiElement element, int startOffset, int endOffset) + public PsiElement reformatRange(@NotNull PsiElement element, int startOffset, int endOffset) throws IncorrectOperationException { return delegate.reformatRange(element, startOffset, endOffset); } @Override public PsiElement reformatRange( - PsiElement element, int startOffset, int endOffset, boolean canChangeWhiteSpacesOnly) + @NotNull PsiElement element, int startOffset, int endOffset, boolean canChangeWhiteSpacesOnly) throws IncorrectOperationException { return delegate.reformatRange(element, startOffset, endOffset, canChangeWhiteSpacesOnly); } @Override - public void reformatText(PsiFile file, int startOffset, int endOffset) + public void reformatText(@NotNull PsiFile file, int startOffset, int endOffset) throws IncorrectOperationException { delegate.reformatText(file, startOffset, endOffset); } @Override - public void reformatText(PsiFile file, Collection ranges) + public void reformatText(@NotNull PsiFile file, @NotNull Collection ranges) throws IncorrectOperationException { delegate.reformatText(file, ranges); } @Override - public void reformatTextWithContext(PsiFile psiFile, ChangedRangesInfo changedRangesInfo) + public void reformatTextWithContext( + @NotNull PsiFile psiFile, @NotNull ChangedRangesInfo changedRangesInfo) throws IncorrectOperationException { delegate.reformatTextWithContext(psiFile, changedRangesInfo); } @Override - public void reformatTextWithContext(PsiFile file, Collection ranges) + public void reformatTextWithContext( + @NotNull PsiFile file, @NotNull Collection ranges) throws IncorrectOperationException { delegate.reformatTextWithContext(file, ranges); } @Override - public void adjustLineIndent(PsiFile file, TextRange rangeToAdjust) + public void adjustLineIndent(@NotNull PsiFile file, TextRange rangeToAdjust) throws IncorrectOperationException { delegate.adjustLineIndent(file, rangeToAdjust); } @Override - public int adjustLineIndent(PsiFile file, int offset) throws IncorrectOperationException { + public int adjustLineIndent(@NotNull PsiFile file, int offset) + throws IncorrectOperationException { return delegate.adjustLineIndent(file, offset); } @Override - public int adjustLineIndent(Document document, int offset) { + public int adjustLineIndent(@NotNull Document document, int offset) { return delegate.adjustLineIndent(document, offset); } - public void scheduleIndentAdjustment(Document document, int offset) { + public void scheduleIndentAdjustment(@NotNull Document document, int offset) { delegate.scheduleIndentAdjustment(document, offset); } @Override - public boolean isLineToBeIndented(PsiFile file, int offset) { + public boolean isLineToBeIndented(@NotNull PsiFile file, int offset) { return delegate.isLineToBeIndented(file, offset); } @Override @Nullable - public String getLineIndent(PsiFile file, int offset) { + public String getLineIndent(@NotNull PsiFile file, int offset) { return delegate.getLineIndent(file, offset); } @Override @Nullable - public String getLineIndent(PsiFile file, int offset, FormattingMode mode) { + public String getLineIndent(@NotNull PsiFile file, int offset, FormattingMode mode) { return delegate.getLineIndent(file, offset, mode); } @Override @Nullable - public String getLineIndent(Document document, int offset) { + public String getLineIndent(@NotNull Document document, int offset) { return delegate.getLineIndent(document, offset); } @@ -165,7 +170,7 @@ public Indent zeroIndent() { } @Override - public void reformatNewlyAddedElement(ASTNode block, ASTNode addedElement) + public void reformatNewlyAddedElement(@NotNull ASTNode block, @NotNull ASTNode addedElement) throws IncorrectOperationException { delegate.reformatNewlyAddedElement(block, addedElement); } @@ -192,22 +197,23 @@ public T performActionWithFormatterDisabled(Computable r) { } @Override - public int getSpacing(PsiFile file, int offset) { + public int getSpacing(@NotNull PsiFile file, int offset) { return delegate.getSpacing(file, offset); } @Override - public int getMinLineFeeds(PsiFile file, int offset) { + public int getMinLineFeeds(@NotNull PsiFile file, int offset) { return delegate.getMinLineFeeds(file, offset); } @Override - public void runWithDocCommentFormattingDisabled(PsiFile file, Runnable runnable) { + public void runWithDocCommentFormattingDisabled( + @NotNull PsiFile file, @NotNull Runnable runnable) { delegate.runWithDocCommentFormattingDisabled(file, runnable); } @Override - public DocCommentSettings getDocCommentSettings(PsiFile file) { + public @NotNull DocCommentSettings getDocCommentSettings(@NotNull PsiFile file) { return delegate.getDocCommentSettings(file); } @@ -223,7 +229,8 @@ public FormattingMode getCurrentFormattingMode() { } @Override - public int adjustLineIndent(final Document document, final int offset, FormattingMode mode) + public int adjustLineIndent( + final @NotNull Document document, final int offset, FormattingMode mode) throws IncorrectOperationException { if (delegate instanceof FormattingModeAwareIndentAdjuster) { return ((FormattingModeAwareIndentAdjuster) delegate) @@ -233,7 +240,7 @@ public int adjustLineIndent(final Document document, final int offset, Formattin } @Override - public void scheduleReformatWhenSettingsComputed(PsiFile file) { + public void scheduleReformatWhenSettingsComputed(@NotNull PsiFile file) { delegate.scheduleReformatWhenSettingsComputed(file); } } diff --git a/idea_plugin/src/com/google/googlejavaformat/intellij/FormatterUtil.java b/idea_plugin/src/com/google/googlejavaformat/intellij/FormatterUtil.java index 9939bbad..a5e69c93 100644 --- a/idea_plugin/src/com/google/googlejavaformat/intellij/FormatterUtil.java +++ b/idea_plugin/src/com/google/googlejavaformat/intellij/FormatterUtil.java @@ -50,8 +50,7 @@ static Map getReplacements( } private static Collection> toRanges(Collection textRanges) { - return textRanges - .stream() + return textRanges.stream() .map(textRange -> Range.closedOpen(textRange.getStartOffset(), textRange.getEndOffset())) .collect(Collectors.toList()); } diff --git a/idea_plugin/src/com/google/googlejavaformat/intellij/GoogleJavaFormatCodeStyleManager.java b/idea_plugin/src/com/google/googlejavaformat/intellij/GoogleJavaFormatCodeStyleManager.java index 550d0a93..3d56743e 100644 --- a/idea_plugin/src/com/google/googlejavaformat/intellij/GoogleJavaFormatCodeStyleManager.java +++ b/idea_plugin/src/com/google/googlejavaformat/intellij/GoogleJavaFormatCodeStyleManager.java @@ -22,10 +22,10 @@ import com.google.googlejavaformat.java.Formatter; import com.google.googlejavaformat.java.JavaFormatterOptions; import com.google.googlejavaformat.java.JavaFormatterOptions.Style; +import com.intellij.ide.highlighter.JavaFileType; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.editor.Document; -import com.intellij.openapi.fileTypes.StdFileTypes; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiElement; @@ -44,7 +44,7 @@ /** * A {@link CodeStyleManager} implementation which formats .java files with google-java-format. - * Formatting of all other types of files is delegated to IJ's default implementation. + * Formatting of all other types of files is delegated to IntelliJ's default implementation. */ class GoogleJavaFormatCodeStyleManager extends CodeStyleManagerDecorator { @@ -53,7 +53,7 @@ public GoogleJavaFormatCodeStyleManager(@NotNull CodeStyleManager original) { } @Override - public void reformatText(PsiFile file, int startOffset, int endOffset) + public void reformatText(@NotNull PsiFile file, int startOffset, int endOffset) throws IncorrectOperationException { if (overrideFormatterForFile(file)) { formatInternal(file, ImmutableList.of(new TextRange(startOffset, endOffset))); @@ -63,7 +63,7 @@ public void reformatText(PsiFile file, int startOffset, int endOffset) } @Override - public void reformatText(PsiFile file, Collection ranges) + public void reformatText(@NotNull PsiFile file, @NotNull Collection ranges) throws IncorrectOperationException { if (overrideFormatterForFile(file)) { formatInternal(file, ranges); @@ -73,7 +73,7 @@ public void reformatText(PsiFile file, Collection ranges) } @Override - public void reformatTextWithContext(PsiFile file, ChangedRangesInfo info) + public void reformatTextWithContext(@NotNull PsiFile file, @NotNull ChangedRangesInfo info) throws IncorrectOperationException { List ranges = new ArrayList<>(); if (info.insertedRanges != null) { @@ -84,7 +84,8 @@ public void reformatTextWithContext(PsiFile file, ChangedRangesInfo info) } @Override - public void reformatTextWithContext(PsiFile file, Collection ranges) { + public void reformatTextWithContext( + @NotNull PsiFile file, @NotNull Collection ranges) { if (overrideFormatterForFile(file)) { formatInternal(file, ranges); } else { @@ -94,7 +95,10 @@ public void reformatTextWithContext(PsiFile file, Collection ranges * Format the ranges of the given document. * *

Overriding methods will need to modify the document with the result of the external - * formatter (usually using {@link #performReplacements(Document, Map)}. + * formatter (usually using {@link #performReplacements(Document, Map)}). */ private void format(Document document, Collection ranges) { Style style = GoogleJavaFormatSettings.getInstance(getProject()).getStyle(); diff --git a/idea_plugin/src/com/google/googlejavaformat/intellij/GoogleJavaFormatSettings.java b/idea_plugin/src/com/google/googlejavaformat/intellij/GoogleJavaFormatSettings.java index f6d9b5ff..1e92a4bd 100644 --- a/idea_plugin/src/com/google/googlejavaformat/intellij/GoogleJavaFormatSettings.java +++ b/idea_plugin/src/com/google/googlejavaformat/intellij/GoogleJavaFormatSettings.java @@ -23,6 +23,7 @@ import com.intellij.openapi.components.Storage; import com.intellij.openapi.project.Project; import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; @State( name = "GoogleJavaFormatSettings", @@ -42,7 +43,7 @@ public State getState() { } @Override - public void loadState(State state) { + public void loadState(@NotNull State state) { this.state = state; } @@ -73,7 +74,7 @@ void setStyle(JavaFormatterOptions.Style style) { enum EnabledState { UNKNOWN, ENABLED, - DISABLED; + DISABLED } static class State { @@ -85,7 +86,7 @@ static class State { public void setEnabled(@Nullable String enabledStr) { if (enabledStr == null) { enabled = EnabledState.UNKNOWN; - } else if (Boolean.valueOf(enabledStr)) { + } else if (Boolean.parseBoolean(enabledStr)) { enabled = EnabledState.ENABLED; } else { enabled = EnabledState.DISABLED; diff --git a/idea_plugin/src/com/google/googlejavaformat/intellij/InitialConfigurationProjectManagerListener.java b/idea_plugin/src/com/google/googlejavaformat/intellij/InitialConfigurationProjectManagerListener.java index da02310c..1906347f 100644 --- a/idea_plugin/src/com/google/googlejavaformat/intellij/InitialConfigurationProjectManagerListener.java +++ b/idea_plugin/src/com/google/googlejavaformat/intellij/InitialConfigurationProjectManagerListener.java @@ -17,8 +17,8 @@ package com.google.googlejavaformat.intellij; import com.intellij.notification.Notification; -import com.intellij.notification.NotificationDisplayType; import com.intellij.notification.NotificationGroup; +import com.intellij.notification.NotificationGroupManager; import com.intellij.notification.NotificationType; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManagerListener; @@ -28,11 +28,10 @@ final class InitialConfigurationProjectManagerListener implements ProjectManager private static final String NOTIFICATION_TITLE = "Enable google-java-format"; private static final NotificationGroup NOTIFICATION_GROUP = - new NotificationGroup(NOTIFICATION_TITLE, NotificationDisplayType.STICKY_BALLOON, true); + NotificationGroupManager.getInstance().getNotificationGroup(NOTIFICATION_TITLE); @Override public void projectOpened(@NotNull Project project) { - GoogleJavaFormatSettings settings = GoogleJavaFormatSettings.getInstance(project); if (settings.isUninitialized()) { From 7629900d72648c7040c87ace856c8a50318ca83d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Feb 2022 08:14:40 -0800 Subject: [PATCH 40/44] Bump checker-qual from 3.21.1 to 3.21.2 Bumps [checker-qual](https://github.com/typetools/checker-framework) from 3.21.1 to 3.21.2.

Release notes

Sourced from checker-qual's releases.

Checker Framework 3.21.2

Version 3.21.2 (February 1, 2022)

User-visible changes:

The wpi.sh script supports non-standard names for build system compile targets via the new -c command-line option.

The Checker Framework now more precisely computes and checks the type of the pattern variable in a pattern match instanceof.

Implementation details:

Deprecated CFGLambda.getMethod{Name} in favor of getEnclosingMethod{Name}.

Closed issues: #4615, #4993, #5006, #5007, #5008, #5013, #5016, #5021.

Changelog

Sourced from checker-qual's changelog.

Version 3.21.2 (March 1, 2022)

User-visible changes:

Implementation details:

Closed issues:

Version 3.21.2 (February 1, 2022)

User-visible changes:

The wpi.sh script supports non-standard names for build system compile targets via the new -c command-line option.

The Checker Framework now more precisely computes and checks the type of the pattern variable in a pattern match instanceof.

Implementation details:

Deprecated CFGLambda.getMethod{Name} in favor of getEnclosingMethod{Name}.

Closed issues: #4615, #4993, #5006, #5007, #5008, #5013, #5016, #5021.

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.checkerframework:checker-qual&package-manager=maven&previous-version=3.21.1&new-version=3.21.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) 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) ---
Dependabot commands and options
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)
Fixes #743 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/743 from google:dependabot/maven/org.checkerframework-checker-qual-3.21.2 d2ffb4a989b7cc261d163aca6e685dd23505df68 PiperOrigin-RevId: 427475341 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1f3855b8..c7f68569 100644 --- a/pom.xml +++ b/pom.xml @@ -89,7 +89,7 @@ 1.8 31.0.1-jre 1.1.3 - 3.21.1 + 3.21.2 2.11.0 1.9 1.0.1 From 71dd2a3897745fa0d5c04c9343e39833a03357c3 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Wed, 9 Feb 2022 11:14:32 -0800 Subject: [PATCH 41/44] Update release.yml Update release workflow to actually push to sonatype --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2c5315d9..09cd0804 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,7 +46,7 @@ jobs: git push origin "v${{ github.event.inputs.version }}" - name: Build Jars - run: mvn --no-transfer-progress clean verify gpg:sign -DskipTests=true -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" + run: mvn --no-transfer-progress -P sonatype-oss-release clean deploy -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" - name: Add Jars to Release Entry uses: softprops/action-gh-release@v0.1.14 From e35f4a9db0f0ed0c4e9d0502ca2592b1abafc7cc Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Wed, 9 Feb 2022 11:25:34 -0800 Subject: [PATCH 42/44] Update release.yml Set up sonatype credentials, and push the tag after `mvn deploy` in case the build fails --- .github/workflows/release.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 09cd0804..c18d40c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,6 +31,9 @@ jobs: java-version: 17 distribution: 'zulu' cache: 'maven' + server-id: sonatype-nexus-staging + server-username: CI_DEPLOY_USERNAME + server-password: CI_DEPLOY_PASSWORD - name: Bump Version Number run: | @@ -43,11 +46,17 @@ jobs: git tag "v${{ github.event.inputs.version }}" echo "TARGET_COMMITISH=$(git rev-parse HEAD)" >> $GITHUB_ENV git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/google/google-java-format.git - git push origin "v${{ github.event.inputs.version }}" - name: Build Jars + env: + CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} + CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }} run: mvn --no-transfer-progress -P sonatype-oss-release clean deploy -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" + - name: Push tag + run: | + git push origin "v${{ github.event.inputs.version }}" + - name: Add Jars to Release Entry uses: softprops/action-gh-release@v0.1.14 with: From 2affc9899279b9ff8fd51df8a70d4e2b9cd309e0 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Wed, 9 Feb 2022 11:36:37 -0800 Subject: [PATCH 43/44] Update release.yml Build the Eclipse plugin separately --- .github/workflows/release.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c18d40c7..a3f066df 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,11 +47,16 @@ jobs: echo "TARGET_COMMITISH=$(git rev-parse HEAD)" >> $GITHUB_ENV git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/google/google-java-format.git - - name: Build Jars + - name: Deploy to Sonatype staging env: CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }} - run: mvn --no-transfer-progress -P sonatype-oss-release clean deploy -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" + run: + mvn --no-transfer-progress -pl '!eclipse_plugin' -P sonatype-oss-release clean deploy -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" + + - name: Build Eclipse plugin + run: + mvn --no-transfer-progress -pl 'eclipse_plugin' verify gpg:sign -DskipTests=true -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" - name: Push tag run: | From 6680f3c4114f99ec524115d039aeafaf12ab2816 Mon Sep 17 00:00:00 2001 From: cushon Date: Wed, 9 Feb 2022 19:37:45 +0000 Subject: [PATCH 44/44] Release google-java-format 1.14.0 --- core/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 1d471595..fefaeb25 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -22,7 +22,7 @@ com.google.googlejavaformat google-java-format-parent - HEAD-SNAPSHOT + 1.14.0 google-java-format diff --git a/pom.xml b/pom.xml index c7f68569..3a3e76b9 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ com.google.googlejavaformat google-java-format-parent pom - HEAD-SNAPSHOT + 1.14.0 core