Skip to content

fix: avoid name collision in enum visitor builder for UNKNOWN member - #3041

Open
arimu1 wants to merge 1 commit into
palantir:developfrom
arimu1:fix-2110-enum-visitor-unknown
Open

fix: avoid name collision in enum visitor builder for UNKNOWN member#3041
arimu1 wants to merge 1 commit into
palantir:developfrom
arimu1:fix-2110-enum-visitor-unknown

Conversation

@arimu1

@arimu1 arimu1 commented Aug 29, 2026

Copy link
Copy Markdown

Summary

  • When an enum defines a member named UNKNOWN, enum visitor builder generation previously emitted two interfaces named UnknownStageVisitorBuilder, which fails to compile (same class of bug as completed has underscore in enum visitor builders #2100 for COMPLETED).
  • Name the unknown-value handler stage unknown_ (generating Unknown_StageVisitorBuilder), matching the existing completed_ / Completed_StageVisitorBuilder pattern for the final stage.
  • Add EnumGeneratorTest covering normal enums and programmatic definitions that include an UNKNOWN member.

Fixes #2110

Test plan

  • ./gradlew :conjure-java-core:test --tests "com.palantir.conjure.java.types.EnumGeneratorTest"
  • ./gradlew :conjure-java-core:test --tests "com.palantir.conjure.java.types.EnumTests"
  • ./gradlew :conjure-java-core:test --tests "com.palantir.conjure.java.parameterized.ParameterizedConjureGenerationTest"

Mirror the completed_ stage naming used for COMPLETED enum values so the
unknown-value handler stage becomes Unknown_StageVisitorBuilder and no
longer collides with UnknownStageVisitorBuilder when an enum defines UNKNOWN.

Fixes palantir#2110
@palantirtech

Copy link
Copy Markdown
Member

Thanks for your interest in palantir/conjure-java, @arimu1! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

@changelog-app

changelog-app Bot commented Aug 29, 2026

Copy link
Copy Markdown

Successfully generated changelog entry!

Entry generated via PR title

To modify this entry, edit PR title using proper format.


📋Changelog Preview

🐛 Fixes

  • Avoid name collision in enum visitor builder for UNKNOWN member (#3041)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enum visitor builders do not compile with UNKNOWN member

2 participants