Title: Multi-resource try-with-resources: break after `(` and drop the stray `; )` · Issue #130 · openjavaformat/open-java-format · GitHub
Open Graph Title: Multi-resource try-with-resources: break after `(` and drop the stray `; )` · Issue #130 · openjavaformat/open-java-format
X Title: Multi-resource try-with-resources: break after `(` and drop the stray `; )` · Issue #130 · openjavaformat/open-java-format
Description: Upstream: google/google-java-format#1454 Kind: idea | Priority: low Open PR google-java-format#1454 (fixes gjf issue google-java-format#1392): with two or more resources the first resource stays glued to try (, and a trailing ; in the so...
Open Graph Description: Upstream: google/google-java-format#1454 Kind: idea | Priority: low Open PR google-java-format#1454 (fixes gjf issue google-java-format#1392): with two or more resources the first resource stays gl...
X Description: Upstream: google/google-java-format#1454 Kind: idea | Priority: low Open PR google-java-format#1454 (fixes gjf issue google-java-format#1392): with two or more resources the first resource stays gl...
Opengraph URL: https://github.com/openjavaformat/open-java-format/issues/130
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Multi-resource try-with-resources: break after `(` and drop the stray `; )`","articleBody":"**Upstream:** https://github.com/google/google-java-format/pull/1454 \n**Kind:** idea | **Priority:** low\n\nOpen PR [google-java-format#1454](https://github.com/google/google-java-format/issues/1454) (fixes gjf issue [google-java-format#1392](https://github.com/google/google-java-format/issues/1392)): with two or more resources the first resource stays\nglued to `try (`, and a trailing `;` in the source yields `...; ) {`. The PR forces a break\nafter `(` for multi-resource statements, puts each resource on its own line, and closes\nthe indent before `)` so it renders at the `try` indentation. Single-resource try is\nunchanged. Golden files B21465217/B26159561/TryWithResources change.\n\nWhy it matters to us: our `visitTry` is the same pre-fix code (same `plusFour` open, same\nhandling of a trailing `;` followed by `builder.space()` before `)`), so we produce the\nsame `; )` artifact. The layout part is a style decision; the trailing-semicolon part is a\nplain wart.\n\nAffected files in our repo:\n- open-java-format/src/main/java/com/palantir/javaformat/java/JavaInputAstVisitor.java (visitTry, around line 1931-1974)\n- try-with-resources test data under open-java-format/src/test/resources/com/palantir/javaformat/java/testdata/\n\nSuggested action: investigate. At minimum consider dropping the trailing `;` / space before\n`)`; adopt the full layout change only if it matches what we want for PALANTIR style\n(it changes existing output, see README note on output changes). Watch upstream review.\n\n---\n_Filed from an upstream-watch ticket after manual review._","author":{"url":"https://github.com/abashev","@type":"Person","name":"abashev"},"datePublished":"2026-10-16T21:07:20Z","url":"https://github.com/openjavaformat/open-java-format/issues/130"}
| 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:c46ac544-21c0-bfa2-5b5c-f6dcdf42f968 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DD28:23A0F:EF041:13BAB6:6AFBAEE4 |
| html-safe-nonce | cebf3782bd8847f33a1cbd7b08c078560d65274acb0eef0ff3fd951f6c10a115 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDI4OjIzQTBGOkVGMDQxOjEzQkFCNjo2QUZCQUVFNCIsInZpc2l0b3JfaWQiOiIzNzEyNTQ4NzAzMjcxNDQxNjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b3a7b5c35249f08e94e509c5d07c80596619010ea9a2ffb02ff71e73cd3978f0 |
| hovercard-subject-tag | issue:5891205760 |
| 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/openjavaformat/open-java-format/130/issue_layout |
| twitter:image | https://opengraph.githubassets.com/56f9723c54a630cd932ac57242b4510b464b43282ea8b44891cafc5d141ee7d7/openjavaformat/open-java-format/issues/130 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/56f9723c54a630cd932ac57242b4510b464b43282ea8b44891cafc5d141ee7d7/openjavaformat/open-java-format/issues/130 |
| og:image:alt | Upstream: google/google-java-format#1454 Kind: idea | Priority: low Open PR google-java-format#1454 (fixes gjf issue google-java-format#1392): with two or more resources the first resource stays gl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | abashev |
| hostname | github.com |
| expected-hostname | github.com |
| None | e25fbd830d3e6ad0e8935c105cf4fdc70c593dffcd27bb45b790ae4fece5ea55 |
| turbo-cache-control | no-preview |
| go-import | github.com/openjavaformat/open-java-format git https://github.com/openjavaformat/open-java-format.git |
| octolytics-dimension-user_id | 325177626 |
| octolytics-dimension-user_login | openjavaformat |
| octolytics-dimension-repository_id | 1288055459 |
| octolytics-dimension-repository_nwo | openjavaformat/open-java-format |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | true |
| octolytics-dimension-repository_parent_id | 214273098 |
| octolytics-dimension-repository_parent_nwo | palantir/palantir-java-format |
| octolytics-dimension-repository_network_root_id | 214273098 |
| octolytics-dimension-repository_network_root_nwo | palantir/palantir-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 | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width