Skip to content

Commit

Permalink
Fix: Long try-with-resources adheres to palantir style (#835)
Browse files Browse the repository at this point in the history
Long try-with-resources statements are now aligned such that the first assignment stays on the first line.
  • Loading branch information
dansanduleac authored and bulldozer-bot[bot] committed Sep 16, 2019
1 parent 8ba4914 commit 7b91586
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
6 changes: 6 additions & 0 deletions changelog/@unreleased/pr-835.v2.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion gradle-baseline-java-config/resources/spotless/eclipse.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="48"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="80"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -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___________________________)) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 7b91586

Please sign in to comment.