-
Notifications
You must be signed in to change notification settings - Fork 68
Fix comments after default switch case expressions #1420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?