Upgrade google-java-format to google-java-format-1.9 am: 196be306dc am: 63e1a67b56
Original change: https://android-review.googlesource.com/c/platform/external/google-java-format/+/1435820
Change-Id: I0faa67c0da4f4698551c7064132b376080377eb8
diff --git a/METADATA b/METADATA
index dc78f17..bbf5fd3 100644
--- a/METADATA
+++ b/METADATA
@@ -1,7 +1,5 @@
name: "google-java-format"
-description:
- "Reformats Java source code to comply with Google Java Style."
-
+description: "Reformats Java source code to comply with Google Java Style."
third_party {
url {
type: HOMEPAGE
@@ -11,7 +9,11 @@
type: GIT
value: "https://github.com/google/google-java-format"
}
- version: "google-java-format-1.8"
- last_upgrade_date { year: 2020 month: 6 day: 12 }
+ version: "google-java-format-1.9"
license_type: NOTICE
+ last_upgrade_date {
+ year: 2020
+ month: 9
+ day: 23
+ }
}
diff --git a/README.md b/README.md
index c5fdee2..9ce3998 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
and run it with:
```
-java -jar /path/to/google-java-format-1.7-all-deps.jar <options> [files...]
+java -jar /path/to/google-java-format-1.8-all-deps.jar <options> [files...]
```
The formatter can act on whole files, on limited lines (`--lines`), on specific
@@ -55,7 +55,7 @@
### Eclipse
-A
+Version 1.6 of the
[google-java-format Eclipse plugin](https://github.com/google/google-java-format/releases/download/google-java-format-1.6/google-java-format-eclipse-plugin_1.6.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)
@@ -68,9 +68,10 @@
### Third-party integrations
* Gradle plugins
- * [Spotless](https://github.com/diffplug/spotless/tree/master/plugin-gradle#applying-to-java-source-google-java-format):
+ * [spotless](https://github.com/diffplug/spotless/tree/main/plugin-gradle#google-java-format)
* [sherter/google-java-format-gradle-plugin](https://github.com/sherter/google-java-format-gradle-plugin)
* Apache Maven plugins
+ * [spotless](https://github.com/diffplug/spotless/tree/main/plugin-maven#google-java-format)
* [coveo/fmt-maven-plugin](https://github.com/coveo/fmt-maven-plugin)
* [talios/googleformatter-maven-plugin](https://github.com/talios/googleformatter-maven-plugin)
* [Cosium/maven-git-code-format](https://github.com/Cosium/maven-git-code-format):
@@ -81,6 +82,9 @@
* [maltzj/google-style-precommit-hook](https://github.com/maltzj/google-style-precommit-hook):
A pre-commit (pre-commit.com) hook that will automatically run GJF whenever
you commit code to your repository
+* [Github Actions](https://github.com/features/actions)
+ * [googlejavaformat-action](https://github.com/axel-op/googlejavaformat-action):
+ Automatically format your Java files when you push on github
### as a library
@@ -94,7 +98,7 @@
<dependency>
<groupId>com.google.googlejavaformat</groupId>
<artifactId>google-java-format</artifactId>
- <version>1.7</version>
+ <version>1.8</version>
</dependency>
```
@@ -102,7 +106,7 @@
```groovy
dependencies {
- compile 'com.google.googlejavaformat:google-java-format:1.7'
+ compile 'com.google.googlejavaformat:google-java-format:1.8'
}
```
diff --git a/appveyor.yml b/appveyor.yml
index 3522155..ac535c9 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,4 +1,10 @@
+# Don't build branches that are not PRs, to avoid double builds.
+branches:
+ only:
+ - master
+
os: Visual Studio 2015
+
install:
- ps: |
Add-Type -AssemblyName System.IO.Compression.FileSystem
diff --git a/core/pom.xml b/core/pom.xml
index 88b3cf9..e5eab9c 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>com.google.googlejavaformat</groupId>
<artifactId>google-java-format-parent</artifactId>
- <version>1.8-SNAPSHOT</version>
+ <version>1.9</version>
</parent>
<artifactId>google-java-format</artifactId>
diff --git a/core/src/main/java/com/google/googlejavaformat/java/java14/Java14InputAstVisitor.java b/core/src/main/java/com/google/googlejavaformat/java/java14/Java14InputAstVisitor.java
index 28a1103..78cfd66 100644
--- a/core/src/main/java/com/google/googlejavaformat/java/java14/Java14InputAstVisitor.java
+++ b/core/src/main/java/com/google/googlejavaformat/java/java14/Java14InputAstVisitor.java
@@ -60,7 +60,11 @@
@Override
public Void visitYield(YieldTree node, Void aVoid) {
sync(node);
- return super.visitYield(node, aVoid);
+ token("yield");
+ builder.space();
+ scan(node.getValue(), null);
+ token(";");
+ return null;
}
@Override
@@ -223,7 +227,7 @@
token(">");
builder.space();
scan(node.getBody(), null);
- token(";");
+ builder.guessToken(";");
break;
default:
throw new AssertionError(node.getCaseKind());
diff --git a/core/src/main/java/com/google/googlejavaformat/java/javadoc/JavadocLexer.java b/core/src/main/java/com/google/googlejavaformat/java/javadoc/JavadocLexer.java
index 108d4a7..cc707ae 100644
--- a/core/src/main/java/com/google/googlejavaformat/java/javadoc/JavadocLexer.java
+++ b/core/src/main/java/com/google/googlejavaformat/java/javadoc/JavadocLexer.java
@@ -507,9 +507,9 @@
// Match "@param <T>" specially in case the <T> is a <P> or other HTML tag we treat specially.
private static final Pattern FOOTER_TAG_PATTERN = compile("^@(param\\s+<\\w+>|[a-z]\\w*)");
private static final Pattern MOE_BEGIN_STRIP_COMMENT_PATTERN =
- compile("^<!--\\s*MOE:begin_intracomment_strip\\s*-->");
+ compile("^<!--\\s*M" + "OE:begin_intracomment_strip\\s*-->");
private static final Pattern MOE_END_STRIP_COMMENT_PATTERN =
- compile("^<!--\\s*MOE:end_intracomment_strip\\s*-->");
+ compile("^<!--\\s*M" + "OE:end_intracomment_strip\\s*-->");
private static final Pattern HTML_COMMENT_PATTERN = fullCommentPattern();
private static final Pattern PRE_OPEN_PATTERN = openTagPattern("pre");
private static final Pattern PRE_CLOSE_PATTERN = closeTagPattern("pre");
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 289ea1b..44ba639 100644
--- a/core/src/test/java/com/google/googlejavaformat/java/FormatterIntegrationTest.java
+++ b/core/src/test/java/com/google/googlejavaformat/java/FormatterIntegrationTest.java
@@ -47,7 +47,8 @@
@RunWith(Parameterized.class)
public class FormatterIntegrationTest {
- private static final ImmutableSet<String> JAVA14_TESTS = ImmutableSet.of("java14");
+ private static final ImmutableSet<String> JAVA14_TESTS =
+ ImmutableSet.of("I477", "Records", "RSLs", "Var", "ExpressionSwitch");
@Parameters(name = "{index}: {0}")
public static Iterable<Object[]> data() throws IOException {
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 4116997..f5103d9 100644
--- a/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java
+++ b/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java
@@ -115,48 +115,48 @@
String[] input = {
"/**",
" * Deatomizes the given user.",
- " * <!-- MOE:begin_intracomment_strip -->",
- " * See go/deatomizer-v5 for the design doc.",
- " * <!-- MOE:end_intracomment_strip -->",
+ " * <!-- M" + "OE:begin_intracomment_strip -->",
+ " * See deatomizer-v5 for the design doc.",
+ " * <!-- M" + "OE:end_intracomment_strip -->",
" * To reatomize, call {@link reatomize}.",
" *",
- " * <!-- MOE:begin_intracomment_strip -->",
+ " * <!-- M" + "OE:begin_intracomment_strip -->",
" * <p>This method is used in the Google teleporter.",
" *",
" * <p>Yes, we have a teleporter.",
- " * <!-- MOE:end_intracomment_strip -->",
+ " * <!-- M" + "OE:end_intracomment_strip -->",
" *",
" * @param user the person to teleport.",
- " * <!-- MOE:begin_intracomment_strip -->",
- " * Users must sign go/deatomize-waiver ahead of time.",
- " * <!-- MOE:end_intracomment_strip -->",
- " * <!-- MOE:begin_intracomment_strip -->",
+ " * <!-- M" + "OE:begin_intracomment_strip -->",
+ " * Users must sign deatomize-waiver ahead of time.",
+ " * <!-- M" + "OE:end_intracomment_strip -->",
+ " * <!-- M" + "OE:begin_intracomment_strip -->",
" * @deprecated Sometimes turns the user into a goat.",
- " * <!-- MOE:end_intracomment_strip -->",
+ " * <!-- M" + "OE:end_intracomment_strip -->",
" */",
"class Test {}",
};
String[] expected = {
"/**",
" * Deatomizes the given user.",
- " * <!-- MOE:begin_intracomment_strip -->",
- " * See go/deatomizer-v5 for the design doc.",
- " * <!-- MOE:end_intracomment_strip -->",
+ " * <!-- M" + "OE:begin_intracomment_strip -->",
+ " * See deatomizer-v5 for the design doc.",
+ " * <!-- M" + "OE:end_intracomment_strip -->",
" * To reatomize, call {@link reatomize}.",
" *",
- " * <!-- MOE:begin_intracomment_strip -->",
+ " * <!-- M" + "OE:begin_intracomment_strip -->",
" * <p>This method is used in the Google teleporter.",
" *",
" * <p>Yes, we have a teleporter.",
- " * <!-- MOE:end_intracomment_strip -->",
+ " * <!-- M" + "OE:end_intracomment_strip -->",
" *",
" * @param user the person to teleport.",
- " * <!-- MOE:begin_intracomment_strip -->",
- " * Users must sign go/deatomize-waiver ahead of time.",
- " * <!-- MOE:end_intracomment_strip -->",
- " * <!-- MOE:begin_intracomment_strip -->",
+ " * <!-- M" + "OE:begin_intracomment_strip -->",
+ " * Users must sign deatomize-waiver ahead of time.",
+ " * <!-- M" + "OE:end_intracomment_strip -->",
+ " * <!-- M" + "OE:begin_intracomment_strip -->",
" * @deprecated Sometimes turns the user into a goat.",
- " * <!-- MOE:end_intracomment_strip -->",
+ " * <!-- M" + "OE:end_intracomment_strip -->",
" */",
"class Test {}",
};
@@ -169,7 +169,7 @@
String[] input = {
"/**", //
" * Foo.",
- " * <!-- MOE:begin_intracomment_strip -->",
+ " * <!-- M" + "OE:begin_intracomment_strip -->",
" * Bar.",
" */",
"class Test {}",
@@ -177,7 +177,7 @@
String[] expected = {
"/**", //
" * Foo.",
- " * <!-- MOE:begin_intracomment_strip -->",
+ " * <!-- M" + "OE:begin_intracomment_strip -->",
" * Bar.",
" */",
"class Test {}",
@@ -192,7 +192,7 @@
String[] input = {
"/**", //
" * Foo.",
- " * <!-- MOE:begin_intracomment_strip -->",
+ " * <!-- M" + "OE:begin_intracomment_strip -->",
" */",
"class Test {}",
};
@@ -209,14 +209,14 @@
String[] input = {
"/**", //
" * Foo.",
- " * <!-- MOE:end_intracomment_strip -->",
+ " * <!-- M" + "OE:end_intracomment_strip -->",
" */",
"class Test {}",
};
String[] expected = {
"/**", //
" * Foo.",
- " * <!-- MOE:end_intracomment_strip -->",
+ " * <!-- M" + "OE:end_intracomment_strip -->",
" */",
"class Test {}",
};
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/ExpressionSwitch.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/ExpressionSwitch.input
new file mode 100644
index 0000000..1e4db16
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/ExpressionSwitch.input
@@ -0,0 +1,28 @@
+class ExpressionSwitch {
+ boolean odd(int x) {
+ return switch (x) {
+ case 0 -> true;
+ case 1 -> false;
+ default -> odd(x - 1);
+ };
+ }
+
+ {
+ int f = switch (i) {
+ case 0 -> 0;
+ default -> {
+ yield n / i;
+ }
+ };
+
+ int g = switch (i) {
+ case 0: yield 0;
+ default: yield n/i;
+ };
+
+ switch (i) {
+ case 0 -> { System.out.println("0"); }
+ default -> System.out.println("default");
+ }
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/ExpressionSwitch.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/ExpressionSwitch.output
new file mode 100644
index 0000000..6458aa0
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/ExpressionSwitch.output
@@ -0,0 +1,34 @@
+class ExpressionSwitch {
+ boolean odd(int x) {
+ return switch (x) {
+ case 0 -> true;
+ case 1 -> false;
+ default -> odd(x - 1);
+ };
+ }
+
+ {
+ int f =
+ switch (i) {
+ case 0 -> 0;
+ default -> {
+ yield n / i;
+ }
+ };
+
+ int g =
+ switch (i) {
+ case 0:
+ yield 0;
+ default:
+ yield n / i;
+ };
+
+ switch (i) {
+ case 0 -> {
+ System.out.println("0");
+ }
+ default -> System.out.println("default");
+ }
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/I477.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I477.input
new file mode 100644
index 0000000..ecd8658
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I477.input
@@ -0,0 +1,17 @@
+class I477 {
+ public static String foo(int in) {
+ return switch (in) {
+ case 1 -> "A";
+ case 2 -> "B";
+ default -> throw new IllegalStateException("Unknown input " + in);
+ };
+ }
+
+ public static String foo(int in) {
+ return switch (in) {
+ case 1 -> "A";
+ case 2 -> "B";
+ default -> "C";
+ };
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/I477.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I477.output
new file mode 100644
index 0000000..ecd8658
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/I477.output
@@ -0,0 +1,17 @@
+class I477 {
+ public static String foo(int in) {
+ return switch (in) {
+ case 1 -> "A";
+ case 2 -> "B";
+ default -> throw new IllegalStateException("Unknown input " + in);
+ };
+ }
+
+ public static String foo(int in) {
+ return switch (in) {
+ case 1 -> "A";
+ case 2 -> "B";
+ default -> "C";
+ };
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/RSLs.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/RSLs.input
new file mode 100644
index 0000000..9c18f0d
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/RSLs.input
@@ -0,0 +1,6 @@
+class RSLs {
+ String s = """
+ lorem
+ ipsum
+ """;
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/RSLs.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/RSLs.output
new file mode 100644
index 0000000..9c18f0d
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/RSLs.output
@@ -0,0 +1,6 @@
+class RSLs {
+ String s = """
+ lorem
+ ipsum
+ """;
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/Records.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/Records.input
new file mode 100644
index 0000000..03a3c06
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/Records.input
@@ -0,0 +1,29 @@
+class Records {
+ record R1() {}
+
+ private record R2() {}
+
+ @Deprecated
+ private record R3() {}
+
+ record R4<T>() {}
+
+ record R5<T>(int x) {}
+
+ record R6<T>(@Deprecated int x) {}
+
+ record R7<T>(@Deprecated int x, int... y) {}
+
+ record R8<T>() implements Comparable<R8<T>> {
+ @Override
+ public int compareTo(R8<T> other) {
+ return 0;
+ }
+ }
+
+ record R9(int x) {
+ R9(int x) {
+ this.x = x;
+ }
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/Records.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/Records.output
new file mode 100644
index 0000000..03a3c06
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/Records.output
@@ -0,0 +1,29 @@
+class Records {
+ record R1() {}
+
+ private record R2() {}
+
+ @Deprecated
+ private record R3() {}
+
+ record R4<T>() {}
+
+ record R5<T>(int x) {}
+
+ record R6<T>(@Deprecated int x) {}
+
+ record R7<T>(@Deprecated int x, int... y) {}
+
+ record R8<T>() implements Comparable<R8<T>> {
+ @Override
+ public int compareTo(R8<T> other) {
+ return 0;
+ }
+ }
+
+ record R9(int x) {
+ R9(int x) {
+ this.x = x;
+ }
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/Var.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/Var.input
new file mode 100644
index 0000000..2633632
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/Var.input
@@ -0,0 +1,5 @@
+class Var {
+ void f() {
+ for (var x : ImmutableList.of(42)) {}
+ }
+}
\ No newline at end of file
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/Var.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/Var.output
new file mode 100644
index 0000000..95d436a
--- /dev/null
+++ b/core/src/test/resources/com/google/googlejavaformat/java/testdata/Var.output
@@ -0,0 +1,5 @@
+class Var {
+ void f() {
+ for (var x : ImmutableList.of(42)) {}
+ }
+}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/java14.input b/core/src/test/resources/com/google/googlejavaformat/java/testdata/java14.input
deleted file mode 100644
index 10d4522..0000000
--- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/java14.input
+++ /dev/null
@@ -1,50 +0,0 @@
-class Java14 {
- void f() {
- if (obj instanceof String s) {
- } else {
- }
- }
-
- record Range<T extends Number>(T lo, T hi) implements Comparable<Range<T>> {
-
- public Range {}
-
- Range(T lo) {
- this(lo, lo);
- }
-
- @Override
- public int compareTo(Range<T> other) {
- throw new UnsupportedOperationException();
- }
- }
-
- record Foo(int id) {}
-
- record Rcv(int id) {
- public Rcv(Rcv this, int id) {
- this.id = id;
- }
- }
-
- void g() {
- var block = """
- hello
- text
- blocks
- """.indent(6);
- }
-
- void h() {
- int numLetters = switch (day) {
- case MONDAY, FRIDAY, SUNDAY -> 6;
- case TUESDAY -> 7;
- case THURSDAY, SATURDAY -> 8;
- case WEDNESDAY -> 9;
- };
- }
-
- {
- for (var arg : List.of()) {}
- }
-}
diff --git a/core/src/test/resources/com/google/googlejavaformat/java/testdata/java14.output b/core/src/test/resources/com/google/googlejavaformat/java/testdata/java14.output
deleted file mode 100644
index 9779198..0000000
--- a/core/src/test/resources/com/google/googlejavaformat/java/testdata/java14.output
+++ /dev/null
@@ -1,51 +0,0 @@
-class Java14 {
- void f() {
- if (obj instanceof String s) {
- } else {
- }
- }
-
- record Range<T extends Number>(T lo, T hi) implements Comparable<Range<T>> {
-
- public Range {}
-
- Range(T lo) {
- this(lo, lo);
- }
-
- @Override
- public int compareTo(Range<T> other) {
- throw new UnsupportedOperationException();
- }
- }
-
- record Foo(int id) {}
-
- record Rcv(int id) {
- public Rcv(Rcv this, int id) {
- this.id = id;
- }
- }
-
- void g() {
- var block = """
- hello
- text
- blocks
- """.indent(6);
- }
-
- void h() {
- int numLetters =
- switch (day) {
- case MONDAY, FRIDAY, SUNDAY -> 6;
- case TUESDAY -> 7;
- case THURSDAY, SATURDAY -> 8;
- case WEDNESDAY -> 9;
- };
- }
-
- {
- for (var arg : List.of()) {}
- }
-}
diff --git a/eclipse_plugin/plugin.xml b/eclipse_plugin/plugin.xml
index 5d0bbf9..b832a1e 100644
--- a/eclipse_plugin/plugin.xml
+++ b/eclipse_plugin/plugin.xml
@@ -1,3 +1,19 @@
+<!--
+ Copyright 2020 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
diff --git a/idea_plugin/build.gradle b/idea_plugin/build.gradle
index 7b2f389..d74957d 100644
--- a/idea_plugin/build.gradle
+++ b/idea_plugin/build.gradle
@@ -15,7 +15,7 @@
*/
plugins {
- id "org.jetbrains.intellij" version "0.4.18"
+ id "org.jetbrains.intellij" version "0.4.21"
}
repositories {
@@ -23,7 +23,7 @@
}
ext {
- googleJavaFormatVersion = '1.7'
+ googleJavaFormatVersion = '1.8'
}
apply plugin: 'org.jetbrains.intellij'
@@ -31,13 +31,13 @@
intellij {
pluginName = "google-java-format"
- version = "2020.1"
+ version = "202.6250.13-EAP-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.5"
+ version = "${googleJavaFormatVersion}.0.1"
sinceBuild = '201'
untilBuild = ''
}
diff --git a/idea_plugin/resources/META-INF/plugin.xml b/idea_plugin/resources/META-INF/plugin.xml
index d633b40..5b313cf 100644
--- a/idea_plugin/resources/META-INF/plugin.xml
+++ b/idea_plugin/resources/META-INF/plugin.xml
@@ -1,3 +1,19 @@
+<!--
+ Copyright 2020 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
<idea-plugin url="https://github.com/google/google-java-format/tree/master/idea_plugin">
<id>google-java-format</id>
<name>google-java-format</name>
@@ -12,6 +28,10 @@
<change-notes><![CDATA[
<dl>
+ <dt>1.8.0.1</dt>
+ <dd>Fixed support for 2020.2 IDEs.<dd>
+ <dt>1.8.0.0</dt>
+ <dd>Updated to use google-java-format 1.8.<dd>
<dt>1.7.0.5</dt>
<dd>Added a version for 2020.1+ IDEs.</dd>
<dt>1.7.0.4</dt>
diff --git a/idea_plugin/src/com/google/googlejavaformat/intellij/CodeStyleManagerDecorator.java b/idea_plugin/src/com/google/googlejavaformat/intellij/CodeStyleManagerDecorator.java
index ee28e1b..c70ba17 100644
--- a/idea_plugin/src/com/google/googlejavaformat/intellij/CodeStyleManagerDecorator.java
+++ b/idea_plugin/src/com/google/googlejavaformat/intellij/CodeStyleManagerDecorator.java
@@ -231,4 +231,9 @@
}
return offset;
}
+
+ @Override
+ public void scheduleReformatWhenSettingsComputed(PsiFile file) {
+ delegate.scheduleReformatWhenSettingsComputed(file);
+ }
}
diff --git a/pom.xml b/pom.xml
index 2ece22d..35bba26 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
<groupId>com.google.googlejavaformat</groupId>
<artifactId>google-java-format-parent</artifactId>
<packaging>pom</packaging>
- <version>1.8-SNAPSHOT</version>
+ <version>1.9</version>
<modules>
<module>core</module>
diff --git a/scripts/google-java-format-diff.py b/scripts/google-java-format-diff.py
index 4c6724b..1abd037 100755
--- a/scripts/google-java-format-diff.py
+++ b/scripts/google-java-format-diff.py
@@ -57,6 +57,8 @@
help='use AOSP style instead of Google Style (4-space indentation)')
parser.add_argument('--skip-sorting-imports', action='store_true',
help='do not fix the import order')
+ parser.add_argument('--skip-removing-unused-imports', action='store_true',
+ help='do not remove ununsed imports')
parser.add_argument('-b', '--binary', help='path to google-java-format binary')
parser.add_argument('--google-java-format-jar', metavar='ABSOLUTE_PATH', default=None,
help='use a custom google-java-format jar')
@@ -112,6 +114,8 @@
command.append('--aosp')
if args.skip_sorting_imports:
command.append('--skip-sorting-imports')
+ if args.skip_removing_unused_imports:
+ command.append('--skip-removing-unused-imports')
command.extend(lines)
command.append(filename)
p = subprocess.Popen(command, stdout=subprocess.PIPE,
diff --git a/scripts/mvn-deploy.sh b/scripts/mvn-deploy.sh
index f6db093..0133e36 100755
--- a/scripts/mvn-deploy.sh
+++ b/scripts/mvn-deploy.sh
@@ -1,4 +1,19 @@
#!/bin/bash
+
+# Copyright 2020 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
if [ $# -lt 1 ]; then
echo "usage $0 <ssl-key> [<param> ...]"
exit 1;
diff --git a/util/publish-snapshot-on-commit.sh b/util/publish-snapshot-on-commit.sh
index 6da8da4..c14368d 100755
--- a/util/publish-snapshot-on-commit.sh
+++ b/util/publish-snapshot-on-commit.sh
@@ -1,3 +1,17 @@
+# Copyright 2020 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
# https://github.com/google/dagger/blob/master/util/publish-snapshot-on-commit.sh
if [ "$TRAVIS_REPO_SLUG" == "google/google-java-format" ] && \
diff --git a/util/settings.xml b/util/settings.xml
index 91f444b..aea3d4e 100644
--- a/util/settings.xml
+++ b/util/settings.xml
@@ -1,3 +1,19 @@
+<!--
+ Copyright 2020 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
<settings>
<servers>
<server>