Skip to content

Add JsonParser.willInternPropertyNames() for property name intern introspection (#1211)#1580

Merged
cowtowncoder merged 2 commits intoFasterXML:3.xfrom
maxpaulus43:issue-1211-intern-field-names-introspection
Mar 26, 2026
Merged

Add JsonParser.willInternPropertyNames() for property name intern introspection (#1211)#1580
cowtowncoder merged 2 commits intoFasterXML:3.xfrom
maxpaulus43:issue-1211-intern-field-names-introspection

Conversation

@maxpaulus43
Copy link
Copy Markdown
Contributor

@maxpaulus43 maxpaulus43 commented Mar 24, 2026

Add ability to determine whether field name interning is enabled for a JsonParser instance, as suggested in GitHub issue #1211.

Changes

  • Add JsonParser.willInternPropertyNames() with default returning false
  • Add isInternStrings() accessor to ByteQuadsCanonicalizer and CharsToNameCanonicalizer symbol tables
  • Override in UTF8StreamJsonParser, ReaderBasedJsonParser, UTF8DataInputJsonParser, and NonBlockingJsonParserBase to delegate to their respective symbol tables
  • Override in JsonParserDelegate to delegate to wrapped parser
  • Add comprehensive unit tests (InternFieldNamesTest) covering all parser types with various feature configurations
  • Update DelegatesTest to verify delegation of new method
  • Add release notes entry under 3.2.0

Closes #1211

@cowtowncoder
Copy link
Copy Markdown
Member

cowtowncoder commented Mar 24, 2026

Quick note on naming: instead of "Field" code uses "Property" for keys of JSON Objects in 3.0. So let's rename method(s).

EDIT: maybe rename as willInternPropertyNames()

@cowtowncoder cowtowncoder added cla-needed PR looks good (although may also require code review), but CLA needed from submitter 3.2 labels Mar 24, 2026
@cowtowncoder
Copy link
Copy Markdown
Member

Aside from naming (apologies, I should have updated the issue earlier), looks good.

One thing we'll need before merging is CLA (from https://github.com/FasterXML/jackson/blob/main/CLA-jackson-2026.pdf) if not yet sent (only needs to be done once, before merging the first contribution; one is good for all future contributions).
The easiest way is usually to print, sign, scan/photo, email to cla at fasterxml dot com.

Looking forward to merging this, thank you!

…pection (FasterXML#1211)

Add ability to determine whether property name interning is enabled for
a JsonParser instance, as suggested in GitHub issue FasterXML#1211.

Changes:
- Add willInternPropertyNames() to JsonParser with default returning
false - Add isInternStrings() accessor to ByteQuadsCanonicalizer and
  CharsToNameCanonicalizer symbol tables
- Override in UTF8StreamJsonParser, ReaderBasedJsonParser,
  UTF8DataInputJsonParser, and NonBlockingJsonParserBase to delegate
  to their respective symbol tables
- Override in JsonParserDelegate to delegate to wrapped parser
- Add comprehensive unit tests (InternPropertyNamesTest) covering all
  parser types with various feature configurations
- Update DelegatesTest to verify delegation of new method
- Add release notes entry under 3.2.0
@maxpaulus43 maxpaulus43 force-pushed the issue-1211-intern-field-names-introspection branch from 6c7f399 to d477b0f Compare March 25, 2026 15:03
@maxpaulus43
Copy link
Copy Markdown
Contributor Author

@cowtowncoder signed CLA and updated naming

@cowtowncoder cowtowncoder added cla-received PR already covered by CLA (optional label) and removed cla-needed PR looks good (although may also require code review), but CLA needed from submitter labels Mar 25, 2026
@cowtowncoder
Copy link
Copy Markdown
Member

Received CLA; hoping to merge later today.

@cowtowncoder cowtowncoder changed the title Add JsonParser.isInterningFieldNames() for field name intern introspection (#1211) Add JsonParser.willInternPropertyNames() for field name intern introspection (#1211) Mar 25, 2026
@cowtowncoder cowtowncoder changed the title Add JsonParser.willInternPropertyNames() for field name intern introspection (#1211) Add JsonParser.willInternPropertyNames() for property name intern introspection (#1211) Mar 26, 2026
@github-actions
Copy link
Copy Markdown

📈 Overall Code Coverage

Metric Coverage Change
Instructions coverage 83.08% 📈 +0.010%
Branches branches 75.74% 📈 +0.010%

Overall project coverage from JaCoCo test results. Change values compare against the latest base branch build.

@cowtowncoder cowtowncoder merged commit c53454a into FasterXML:3.x Mar 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.2 cla-received PR already covered by CLA (optional label)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add JsonParser.willInternPropertyNames() to check whether property name interning is enabled

2 participants