Skip to content

Conversation

@cowtowncoder
Copy link
Member

@cowtowncoder cowtowncoder commented Oct 27, 2025

Fix #598: Separate END_OBJECT return from parser close in ProtobufParser

Previously, ProtobufParser would call close() while simultaneously returning END_OBJECT at the top level, causing the parser to be in a closed state immediately after returning the final token. This created incompatibility with jackson-core issue #1438.

Solution:
- Added new parser state STATE_ROOT_END to separate the two actions
- Parser now returns END_OBJECT in STATE_ROOT_END state
- Parser only closes on the subsequent nextToken() call
- Updated all methods: nextToken(), nextName(), nextName(SerializableString),
nextNameMatch(), and _skipUnknownField()
- Clear current name when transitioning to STATE_ROOT_END

NOTE: PR created on Claude Code proposed fix.

Previously, ProtobufParser would call close() while simultaneously returning
END_OBJECT at the top level, causing the parser to be in a closed state
immediately after returning the final token. This created incompatibility
with jackson-core issue #1438.

Solution:
- Added new parser state STATE_ROOT_END to separate the two actions
- Parser now returns END_OBJECT in STATE_ROOT_END state
- Parser only closes on the subsequent nextToken() call
- Updated all methods: nextToken(), nextName(), nextName(SerializableString),
  nextNameMatch(), and _skipUnknownField()
- Clear current name when transitioning to STATE_ROOT_END

Also added CLAUDE.md documentation file for AI assistants working with
this codebase.

Tests:
- Added ParserStateEndTest with 3 test methods verifying correct behavior
- All 98 protobuf tests pass with no regressions
@cowtowncoder cowtowncoder added the gen-ai PR created with Generative AI (whole or assisted) (or issue for which gen-ai seems suitable) label Oct 27, 2025
@cowtowncoder cowtowncoder merged commit 4b08f73 into 3.x Oct 27, 2025
3 checks passed
@cowtowncoder cowtowncoder deleted the claude/3.x/fix-598-protobuf-parser-state branch October 27, 2025 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.1 gen-ai PR created with Generative AI (whole or assisted) (or issue for which gen-ai seems suitable) protobuf

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Protobuf parser state handling wrong for implicit close (END_OBJECT)

2 participants