diff --git a/changelog/@unreleased/pr-835.v2.yml b/changelog/@unreleased/pr-835.v2.yml new file mode 100644 index 000000000..59df26054 --- /dev/null +++ b/changelog/@unreleased/pr-835.v2.yml @@ -0,0 +1,6 @@ +type: fix +fix: + description: Long try-with-resources statements are now aligned such that the first + assignment stays on the first line. + links: + - https://github.com/palantir/gradle-baseline/pull/835 diff --git a/gradle-baseline-java-config/resources/spotless/eclipse.xml b/gradle-baseline-java-config/resources/spotless/eclipse.xml index cff10b095..7bf7de787 100644 --- a/gradle-baseline-java-config/resources/spotless/eclipse.xml +++ b/gradle-baseline-java-config/resources/spotless/eclipse.xml @@ -177,7 +177,7 @@ - + diff --git a/gradle-baseline-java/src/test/resources/com/palantir/baseline/googlejavaformat-expected/B21465217.java b/gradle-baseline-java/src/test/resources/com/palantir/baseline/googlejavaformat-expected/B21465217.java index 36c5ab7da..304ae6c2d 100644 --- a/gradle-baseline-java/src/test/resources/com/palantir/baseline/googlejavaformat-expected/B21465217.java +++ b/gradle-baseline-java/src/test/resources/com/palantir/baseline/googlejavaformat-expected/B21465217.java @@ -1,7 +1,6 @@ class B21465217 { void m() { - try ( - JimfsOutputStream out2 = newOutputStream(false); + try (JimfsOutputStream out2 = newOutputStream(false); BufferedOutputStream bout = new BufferedOutputStream(out2); OutputStreamWriter writer = new OutputStreamWriter(bout, UTF_8___________________________)) {} diff --git a/gradle-baseline-java/src/test/resources/com/palantir/baseline/googlejavaformat-expected/TryWithResources.java b/gradle-baseline-java/src/test/resources/com/palantir/baseline/googlejavaformat-expected/TryWithResources.java index 16562652e..96f665b79 100644 --- a/gradle-baseline-java/src/test/resources/com/palantir/baseline/googlejavaformat-expected/TryWithResources.java +++ b/gradle-baseline-java/src/test/resources/com/palantir/baseline/googlejavaformat-expected/TryWithResources.java @@ -8,9 +8,8 @@ class TryWtihResources { try (@A final @B C c = c();) {} - try ( - final BufferedWriter writer = - new BufferedWriter(new OutputStreamWriter(testFile, Charset.defaultCharset()))) { + try (final BufferedWriter writer = + new BufferedWriter(new OutputStreamWriter(testFile, Charset.defaultCharset()))) { writer.append("tom cruise\n").append("avatar\n"); writer.flush(); }