Skip to content

java: Add explicit property names to constructor arguments #399

Draft
mpkorstanje wants to merge 2 commits intomainfrom
add-property-name-annotation
Draft

java: Add explicit property names to constructor arguments #399
mpkorstanje wants to merge 2 commits intomainfrom
add-property-name-annotation

Conversation

@mpkorstanje
Copy link
Copy Markdown
Contributor

⚡️ What's your motivation?

To de-serialize messages a deserializer has to know what order the fields of a constructor are in. By default Java does not provide the parameter names for constructor arguments. They're purely positional. We do however include that information as debug symbols and de-serialisers are smart enough to read those. But they can be optimized out (cucumber/messages-cli#50) for smaller runtime images.

By adding an annotation with the property name, de-serialisers will be able to match constructor fields to values.

🏷️ What kind of change is this?

  • ⚡ New feature (non-breaking change which adds new behaviour)

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

mpkorstanje added a commit to cucumber/messages-ndjson that referenced this pull request Apr 6, 2026
mpkorstanje added a commit to cucumber/messages-ndjson that referenced this pull request Apr 6, 2026
mpkorstanje added a commit to cucumber/messages-cli that referenced this pull request Apr 6, 2026
Deserialize using explicitly defined property names utilizing
cucumber/messages#399.

Closes: #50
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.

1 participant