Skip to content

Fix switches with both types and enum values - #612

Merged
jaskarth merged 4 commits into
Vineflower:develop/1.13.0from
coehlrich:fix-combined-type-enum-switch
Aug 18, 2026
Merged

Fix switches with both types and enum values#612
jaskarth merged 4 commits into
Vineflower:develop/1.13.0from
coehlrich:fix-combined-type-enum-switch

Conversation

@coehlrich

Copy link
Copy Markdown
Contributor

Fixes switches with both types and enum values

@electronicboy

Copy link
Copy Markdown

This fixes the decompilation entirely failing with NoiseChunk, but the output is missing the class label and so isn't re-compilable

@jaskarth jaskarth added Subsystem: Statement Structure Anything concerning how statements are structured in a method Priority: High High priority Type: Bugfix Fixes a bug labels Aug 18, 2026

@jaskarth jaskarth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this PR! The logic looks good, I just have two comments here.

public TextBuffer toJava(int indent) {
TextBuffer buf = new TextBuffer();

if (wasCondy) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to keep this. If this shows up in switch specific code, could a flag be set to suppress it when it's resugared?

VALUE1,
VALUE2;
}
public String test7(Object o) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be good to add a test that uses a when clause, to make sure that those work with this too.

@jaskarth jaskarth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks again for this PR!

@jaskarth
jaskarth merged commit 36ac62e into Vineflower:develop/1.13.0 Aug 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: High High priority Subsystem: Statement Structure Anything concerning how statements are structured in a method Type: Bugfix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants