Skip to content

Conversation

@brunofrts
Copy link
Collaborator

@brunofrts brunofrts commented Apr 28, 2025

This PR fixes two bugs

  1. constructorTakesAllFields() did not take into account the fact that each field in a oneOf contributes to the parameter list in the constructor. This makes it impossible to compile messages with very long oneOfs since Java limits parameter lists to 255 elements.
  2. The check for REPEATED was performed before verifying a field’s label is not null in generateOptionType, so unlabeled fields would trigger a NPE. The comparison order has been flipped to avoid this.

The two tests introduced fail in the previous build.

+ " int32 foo = 257;\n"
+ " int32 bar = 258;\n"
+ " }\n"
+ " oneof oneof_name {\n"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Only fixed indentation for this test, diff looks a bit odd due to next (new) test using the same assert.

@brunofrts brunofrts marked this pull request as ready for review April 29, 2025 01:50
@brunofrts brunofrts merged commit 560b597 into master Apr 29, 2025
9 checks passed
@brunofrts brunofrts deleted the brunof/bug-fixes branch April 29, 2025 01: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.

3 participants