Skip to content

[java][bidi] Fix special-number serialization and inbound null handling - #18155

Open
SantoshSarma wants to merge 2 commits into
SeleniumHQ:trunkfrom
SantoshSarma:fix/java-bidi-18129
Open

SantoshSarma wants to merge 2 commits into
SeleniumHQ:trunkfrom
SantoshSarma:fix/java-bidi-18129

Conversation

@SantoshSarma

@SantoshSarma SantoshSarma commented Oct 12, 2026 •

Copy link
Copy Markdown

🔗 Related Issues

Fixes #18129

💥 What does this PR do?

Fix generated Java BiDi types rejecting valid special-number wire strings, emitting raw enum objects from NumberValue.toMap(), accepting explicit null for non-nullable fields, and losing explicit-null presence for optional nullable fields.

Adds regressions for all four SpecialNumber wire values, ordinary numbers, invalid union values, SharedReference.handle:null rejection, and Info.parent null-versus-absent presence.

🔧 Implementation Notes

  • Coerce a string-valued enum arm before inline-union constructor validation, and serialize enum union arms through toWireValue().
  • Generate a fromJson decoder for each record to enforce required-key presence and field nullability before Optional conversion loses that information.
  • Pass map.containsKey(wire) through nullable-field SetOverride parameters, including receiver-only records.
  • Preserve extension capture and unknown-field warnings in custom decoders; leave the shared ConstructorCoercer unchanged.

🤖 AI assistance

  • No substantial AI assistance used
  • AI assisted (complete below)
    • Tool(s): OpenAI Codex
    • What was generated: generator implementation changes, regression tests, and this PR description; Codex also ran build and test commands.
    • I reviewed all AI output and can explain the change

💡 Additional Considerations

Validation:

  • Reproduced four failing regression methods on the original generator.
  • 16 small BiDi test targets passed: 69 test cases, no failures or skips. After rebasing onto current trunk, the three changed test targets reran and passed; the other 13 targets reused passing cached results.
  • All 480 targets under //java/src/... built successfully.
  • Selenium's ./scripts/format.sh --pre-push passed (Buildifier, copyright, and Java format); git diff --check passed.
  • Validation used the installed macOS SDK 26.5 via a local repository override, matching the requested SDK version, and --pin_browsers=false to avoid stalled browser downloads. No dependency files changed; browser integration tests were not run.

A comprehensive generator unit-test suite for #18128 remains separate from this bug fix.

🔄 Types of changes

  • Bug fix

@selenium-ci selenium-ci added C-java Java Bindings B-devtools Includes everything BiDi or Chrome DevTools related labels Oct 12, 2026
@CLAassistant

CLAassistant commented Oct 12, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ SantoshSarma
❌ santhosh-sarma-0007
You have signed the CLA already but the status is still pending? Let us recheck it.

@SantoshSarma
SantoshSarma marked this pull request as ready for review October 13, 2026 04:45
@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@diemol

diemol commented Oct 29, 2026

Copy link
Copy Markdown
Member

@SantoshSarma The CLA needs to be signed, please.

This branch has not been deployed

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

Labels

B-devtools Includes everything BiDi or Chrome DevTools related C-java Java Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[java][bidi] Generated types mishandle special numbers and inbound nulls

5 participants