You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Leading comment after an opening delimiter is hoisted out of its group #171
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 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.
Why 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.
open-java-format/src/main/java/com/palantir/javaformat/doc (comment handling in the layout builder)
Suggested 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.
Filed from an upstream-watch ticket after manual review.
Activity