Title: Consistent formatting of multivariable try-with-resource blocks. · Issue #1392 · google/google-java-format · GitHub
Open Graph Title: Consistent formatting of multivariable try-with-resource blocks. · Issue #1392 · google/google-java-format
X Title: Consistent formatting of multivariable try-with-resource blocks. · Issue #1392 · google/google-java-format
Description: The current formatting of try-with-resource blocks that manage multiple variables is strange, as it results in inconsistent alignment and doesn't match how multiline parameters or code blocks are formatted. Current output: try (var input...
Open Graph Description: The current formatting of try-with-resource blocks that manage multiple variables is strange, as it results in inconsistent alignment and doesn't match how multiline parameters or code blocks are f...
X Description: The current formatting of try-with-resource blocks that manage multiple variables is strange, as it results in inconsistent alignment and doesn't match how multiline parameters or code blocks a...
Opengraph URL: https://github.com/google/google-java-format/issues/1392
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Consistent formatting of multivariable try-with-resource blocks.","articleBody":"The current formatting of try-with-resource blocks that manage multiple variables is strange, as it results in inconsistent alignment and doesn't match how multiline parameters or code blocks are formatted.\n\nCurrent output:\n```java\ntry (var input = Files.newInputStream(Path.of(\"./input\"));\n var output = Files.newOutputStream(Path.of(\"./output\")); ) {\n output.write(input.read());\n} catch (IOException _) {\n}\n```\n\nHow I think it should be formatted:\n```java\ntry (\n var input = Files.newInputStream(Path.of(\"./input\"));\n var output = Files.newOutputStream(Path.of(\"./output\"));\n) {\n output.write(input.read());\n} catch (IOException _) {\n}\n```","author":{"url":"https://github.com/thatcomputerguy0101","@type":"Person","name":"thatcomputerguy0101"},"datePublished":"2026-05-31T12:54:29Z","url":"https://github.com/google/google-java-format/issues/1392"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1458f615-06d1-636c-21f6-419eaf2f818e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D242:2EDE49:23CD0E:30B43E:6AFBAF5D |
| html-safe-nonce | 5d916a786f0d0626898e6647be6e01b38dfdec9ec622f49e2a8eb2a4c5f6fc81 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMjQyOjJFREU0OToyM0NEMEU6MzBCNDNFOjZBRkJBRjVEIiwidmlzaXRvcl9pZCI6Ijg1OTIxMDgxNzc5NTkxMzcxMTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b1b2cf73747dc57e68a4084fbae6919a278968b5a2790345aaa95bb544738c62 |
| hovercard-subject-tag | issue:4557613184 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/google/google-java-format/1392/issue_layout |
| twitter:image | https://opengraph.githubassets.com/85f3e47262383a2cf47278876b2d63b411732ea6ebdf6cd873c1567d14c6912d/google/google-java-format/issues/1392 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/85f3e47262383a2cf47278876b2d63b411732ea6ebdf6cd873c1567d14c6912d/google/google-java-format/issues/1392 |
| og:image:alt | The current formatting of try-with-resource blocks that manage multiple variables is strange, as it results in inconsistent alignment and doesn't match how multiline parameters or code blocks are f... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | thatcomputerguy0101 |
| hostname | github.com |
| expected-hostname | github.com |
| None | e25fbd830d3e6ad0e8935c105cf4fdc70c593dffcd27bb45b790ae4fece5ea55 |
| turbo-cache-control | no-preview |
| go-import | github.com/google/google-java-format git https://github.com/google/google-java-format.git |
| octolytics-dimension-user_id | 1342004 |
| octolytics-dimension-user_login | |
| octolytics-dimension-repository_id | 35448780 |
| octolytics-dimension-repository_nwo | google/google-java-format |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 35448780 |
| octolytics-dimension-repository_network_root_nwo | google/google-java-format |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 08c8f17f9d27054a108b8b6254e405de0151f660 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width