@@ -987,7 +987,6 @@ object JsonCodecMaker {
987
987
else if (tpe =:= definitions.LongTpe || tpe =:= typeOf[java.lang.Long ]) q " in.readKeyAsLong() "
988
988
else if (tpe =:= definitions.FloatTpe || tpe =:= typeOf[java.lang.Float ]) q " in.readKeyAsFloat() "
989
989
else if (tpe =:= definitions.DoubleTpe || tpe =:= typeOf[java.lang.Double ]) q " in.readKeyAsDouble() "
990
- else if (isValueClass(tpe)) q " new $tpe( ${genReadKey(valueClassValueType(tpe) :: types)}) "
991
990
else if (tpe =:= typeOf[BigInt ]) q " in.readKeyAsBigInt( ${cfg.bigIntDigitsLimit}) "
992
991
else if (tpe =:= typeOf[BigDecimal ]) {
993
992
val mc = withMathContextFor(cfg.bigDecimalPrecision)
@@ -1007,6 +1006,7 @@ object JsonCodecMaker {
1007
1006
else if (tpe =:= typeOf[ZonedDateTime ]) q " in.readKeyAsZonedDateTime() "
1008
1007
else if (tpe =:= typeOf[ZoneId ]) q " in.readKeyAsZoneId() "
1009
1008
else if (tpe =:= typeOf[ZoneOffset ]) q " in.readKeyAsZoneOffset() "
1009
+ else if (isValueClass(tpe)) q " new $tpe( ${genReadKey(valueClassValueType(tpe) :: types)}) "
1010
1010
else if (tpe <:< typeOf[Enumeration # Value ]) {
1011
1011
val ec = withScalaEnumCacheFor(tpe)
1012
1012
if (cfg.useScalaEnumValueId) {
@@ -1420,6 +1420,7 @@ object JsonCodecMaker {
1420
1420
else if (tpe =:= definitions.FloatTpe || tpe =:= typeOf[java.lang.Float ]) q " 0f "
1421
1421
else if (tpe =:= definitions.DoubleTpe || tpe =:= typeOf[java.lang.Double ]) q " 0.0 "
1422
1422
else if (isOption(tpe, types.tail)) q " _root_.scala.None "
1423
+ else if (isValueClass(tpe)) q " new $tpe( ${genNullValue(valueClassValueType(tpe) :: types)}) "
1423
1424
else if (tpe <:< typeOf[mutable.BitSet ]) q " new _root_.scala.collection.mutable.BitSet "
1424
1425
else if (tpe <:< typeOf[collection.BitSet ]) withNullValueFor(tpe)(q " _root_.scala.collection.immutable.BitSet.empty " )
1425
1426
else if (tpe <:< typeOf[mutable.LongMap [? ]]) q " ${scalaCollectionCompanion(tpe)}.empty[ ${typeArg1(tpe)}] "
@@ -1452,7 +1453,6 @@ object JsonCodecMaker {
1452
1453
case _ => cannotFindValueCodecError(tpe)
1453
1454
}
1454
1455
} else if (tpe.typeSymbol.isModuleClass) q " ${tpe.typeSymbol.asClass.module}"
1455
- else if (isValueClass(tpe)) q " new $tpe( ${genNullValue(valueClassValueType(tpe) :: types)}) "
1456
1456
else if (tpe <:< typeOf[AnyRef ]) q " null "
1457
1457
else q " null.asInstanceOf[ $tpe] "
1458
1458
}
@@ -1638,6 +1638,16 @@ object JsonCodecMaker {
1638
1638
} else if (tpe =:= definitions.DoubleTpe || tpe =:= typeOf[java.lang.Double ]) {
1639
1639
if (isStringified) q " in.readStringAsDouble() "
1640
1640
else q " in.readDouble() "
1641
+ } else if (tpe =:= typeOf[BigInt ]) {
1642
+ if (isStringified) q " in.readStringAsBigInt( $default, ${cfg.bigIntDigitsLimit}) "
1643
+ else q " in.readBigInt( $default, ${cfg.bigIntDigitsLimit}) "
1644
+ } else if (tpe =:= typeOf[BigDecimal ]) {
1645
+ val mc = withMathContextFor(cfg.bigDecimalPrecision)
1646
+ if (isStringified) {
1647
+ q " in.readStringAsBigDecimal( $default, $mc, ${cfg.bigDecimalScaleLimit}, ${cfg.bigDecimalDigitsLimit}) "
1648
+ } else {
1649
+ q " in.readBigDecimal( $default, $mc, ${cfg.bigDecimalScaleLimit}, ${cfg.bigDecimalDigitsLimit}) "
1650
+ }
1641
1651
} else if (tpe =:= typeOf[java.util.UUID ]) q " in.readUUID( $default) "
1642
1652
else if (tpe =:= typeOf[Duration ]) q " in.readDuration( $default) "
1643
1653
else if (tpe =:= typeOf[Instant ]) q " in.readInstant( $default) "
@@ -1653,17 +1663,7 @@ object JsonCodecMaker {
1653
1663
else if (tpe =:= typeOf[ZonedDateTime ]) q " in.readZonedDateTime( $default) "
1654
1664
else if (tpe =:= typeOf[ZoneId ]) q " in.readZoneId( $default) "
1655
1665
else if (tpe =:= typeOf[ZoneOffset ]) q " in.readZoneOffset( $default) "
1656
- else if (tpe =:= typeOf[BigInt ]) {
1657
- if (isStringified) q " in.readStringAsBigInt( $default, ${cfg.bigIntDigitsLimit}) "
1658
- else q " in.readBigInt( $default, ${cfg.bigIntDigitsLimit}) "
1659
- } else if (tpe =:= typeOf[BigDecimal ]) {
1660
- val mc = withMathContextFor(cfg.bigDecimalPrecision)
1661
- if (isStringified) {
1662
- q " in.readStringAsBigDecimal( $default, $mc, ${cfg.bigDecimalScaleLimit}, ${cfg.bigDecimalDigitsLimit}) "
1663
- } else {
1664
- q " in.readBigDecimal( $default, $mc, ${cfg.bigDecimalScaleLimit}, ${cfg.bigDecimalDigitsLimit}) "
1665
- }
1666
- } else if (isValueClass(tpe)) {
1666
+ else if (isValueClass(tpe)) {
1667
1667
val tpe1 = valueClassValueType(tpe)
1668
1668
q " new $tpe( ${genReadVal(tpe1 :: types, genNullValue(tpe1 :: types), isStringified, EmptyTree )}) "
1669
1669
} else if (isOption(tpe, types.tail)) {
0 commit comments