-
Notifications
You must be signed in to change notification settings - Fork 0
Closed as not planned
Description
Problem
Older revisions of this backport included convenience constructors/factories on the core java.util.json types (notably around JsonNumber) that accepted BigDecimal / BigInteger. After the most recent sync from upstream openjdk/jdk-sandbox those APIs are no longer present.
This leaves users wondering:
- what happened to the BigDecimal/BigInteger entry points
- whether their removal was accidental vs. deliberate upstream design
- how to do lossless numeric handling without the constructor explosion typical of legacy OO APIs
Goal
Document the design choice: JSON numbers are represented primarily as lexical decimal text, with minimal numeric factories (double, long, String) and lossless conversion via toString().
Add runnable examples (and tests) showing:
- precision loss with
double - lossless conversion using
BigDecimal/BigIntegerviatoString() - how to build
JsonNumberfromBigDecimalwithout adding new overloads - how lexically-preserving
toString()differs from numeric normalization
Deliverables
DESIGN_CHOICES.mdanalysis with examples- matching example sources under
json-java21/src/main/...andjson-java21/src/test/...
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels