Fix comments after default switch case expressions#1420
Fix comments after default switch case expressions#1420bulldozer-bot[bot] merged 2 commits intodevelopfrom
Conversation
Generate changelog in
|
✅ Successfully generated changelog entry!What happened?Your changelog entries have been stored in the database as part of our migration to ChangelogV3. Need to regenerate?Simply interact with the changelog bot comment again to regenerate these entries. 🔄 Changelog entries were re-generated at Thu, 25 Sep 2025 17:10:52 UTC! |
| } | ||
|
|
||
|
|
||
| public void testWithComments(int y) { |
There was a problem hiding this comment.
is this the intended snippet for the before? I couldn't see what the difference was manually, and both diff and difft report no differences.
There was a problem hiding this comment.
yes, without this change, the formatter would put the "}" on the same line as the comment - which breaks the compilation eg.
x = switch (y) {
case 1 -> 1;
// after case 1
case 2 -> throw new IllegalArgumentException();
// after case 2
default -> throw new IllegalStateException();
// after default case};
There was a problem hiding this comment.
ah, are you able to put that in the description, it's quite hard to tell what's being fixed from just the code + PR description
There was a problem hiding this comment.
I've changed the input to a wrongly formatted switch expression here
Invalidated by push of 78dc770
|
👍 I keep forgetting invalidated on push on public gh |
|
Released 2.75.0 |
Before this PR
After this PR
Fixes parsing of switch expressions that have a comment before the closing "}". (internal example here with the corresponding failure here). Internal discussion here
==COMMIT_MSG==
Fix comments after default switch case expressions
==COMMIT_MSG==
Possible downsides?