Title: Leading comment after an opening delimiter is hoisted out of its group · Issue #171 · openjavaformat/open-java-format · GitHub
Open Graph Title: Leading comment after an opening delimiter is hoisted out of its group · Issue #171 · openjavaformat/open-java-format
X Title: Leading comment after an opening delimiter is hoisted out of its group · Issue #171 · openjavaformat/open-java-format
Description: Upstream: google/google-java-format#1501 Kind: bug | Priority: low google-java-format#1501 (merged 2026-10-29, copybara export; groundwork in google-java-format#1500 and baseline tests in google-java-format#1502) fixes comments placed ri...
Open Graph Description: Upstream: google/google-java-format#1501 Kind: bug | Priority: low google-java-format#1501 (merged 2026-10-29, copybara export; groundwork in google-java-format#1500 and baseline tests in google-ja...
X Description: Upstream: google/google-java-format#1501 Kind: bug | Priority: low google-java-format#1501 (merged 2026-10-29, copybara export; groundwork in google-java-format#1500 and baseline tests in google-ja...
Opengraph URL: https://github.com/openjavaformat/open-java-format/issues/171
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Leading comment after an opening delimiter is hoisted out of its group","articleBody":"**Upstream:** https://github.com/google/google-java-format/pull/1501 \n**Kind:** bug | **Priority:** low\n\n[google-java-format#1501](https://github.com/google/google-java-format/pull/1501) (merged 2026-10-29, copybara export; groundwork in [google-java-format#1500](https://github.com/google/google-java-format/pull/1500) and baseline tests in [google-java-format#1502](https://github.com/google/google-java-format/pull/1502)) fixes comments placed right after an opening token being pulled out of the indented group, leaving the comment and the next line unindented. Cases covered: `assert` with a detail message, the semicolon after enum constants, `for` initializers, multi-resource `try` headers, multi-catch clauses and explicit type argument lists. After the fix such comments stay indented inside the group, for example in a `for (` header the comment, `int i = 0;`, the condition and the update each get their own continuation-indented line.\n\nWhy it matters: it is a correctness-of-layout bug class around comments that our engine may share, since both derive from the same original visitor design.\n\nAffected files in our repo:\n- open-java-format/src/main/java/com/palantir/javaformat/java/JavaInputAstVisitor.java\n- open-java-format/src/main/java/com/palantir/javaformat/doc (comment handling in the layout builder)\n\nSuggested action: investigate. Put a comment after `for (` and after `try (` into our formatter and compare the indentation. Examples: not available - the pre-change output is only in the baseline test PR and I did not run our formatter.\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-30T10:01:46Z","url":"https://github.com/openjavaformat/open-java-format/issues/171"}
| 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:14f64136-c58e-ff24-c012-6125f9d252c5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8A3C:110FE5:5F3F13:7EB647:6AFBC740 |
| html-safe-nonce | 46c5712c75970e81ab4f82b077e85521ccfa396bf704418394b5d5cd70ced2a1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTNDOjExMEZFNTo1RjNGMTM6N0VCNjQ3OjZBRkJDNzQwIiwidmlzaXRvcl9pZCI6IjE5Mzg2Mzg5MTUxMTE3MzMwNTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 22869cfc30db6d10cbd822ae4d0a4b77154ae66a6c0219a9ce235f39100c445f |
| hovercard-subject-tag | issue:6117010713 |
| 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/171/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b5064f5b2e0ba49db8de2ccbb5f1e099ef843f4d1e6619d517c5ec625a8faac2/openjavaformat/open-java-format/issues/171 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b5064f5b2e0ba49db8de2ccbb5f1e099ef843f4d1e6619d517c5ec625a8faac2/openjavaformat/open-java-format/issues/171 |
| og:image:alt | Upstream: google/google-java-format#1501 Kind: bug | Priority: low google-java-format#1501 (merged 2026-10-29, copybara export; groundwork in google-java-format#1500 and baseline tests in google-ja... |
| 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 | d440bda0d812801778b27bfe9f7c1ce9ff22420c73f6f95150c4fcbca311c50b |
| 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 | 2c43021aed8695990c86c0eaaedc600bfeffec36 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width