@@ -987,7 +987,6 @@ object JsonCodecMaker {
987987 else if (tpe =:= definitions.LongTpe || tpe =:= typeOf[java.lang.Long ]) q " in.readKeyAsLong() "
988988 else if (tpe =:= definitions.FloatTpe || tpe =:= typeOf[java.lang.Float ]) q " in.readKeyAsFloat() "
989989 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)}) "
991990 else if (tpe =:= typeOf[BigInt ]) q " in.readKeyAsBigInt( ${cfg.bigIntDigitsLimit}) "
992991 else if (tpe =:= typeOf[BigDecimal ]) {
993992 val mc = withMathContextFor(cfg.bigDecimalPrecision)
@@ -1007,6 +1006,7 @@ object JsonCodecMaker {
10071006 else if (tpe =:= typeOf[ZonedDateTime ]) q " in.readKeyAsZonedDateTime() "
10081007 else if (tpe =:= typeOf[ZoneId ]) q " in.readKeyAsZoneId() "
10091008 else if (tpe =:= typeOf[ZoneOffset ]) q " in.readKeyAsZoneOffset() "
1009+ else if (isValueClass(tpe)) q " new $tpe( ${genReadKey(valueClassValueType(tpe) :: types)}) "
10101010 else if (tpe <:< typeOf[Enumeration # Value ]) {
10111011 val ec = withScalaEnumCacheFor(tpe)
10121012 if (cfg.useScalaEnumValueId) {
@@ -1420,6 +1420,7 @@ object JsonCodecMaker {
14201420 else if (tpe =:= definitions.FloatTpe || tpe =:= typeOf[java.lang.Float ]) q " 0f "
14211421 else if (tpe =:= definitions.DoubleTpe || tpe =:= typeOf[java.lang.Double ]) q " 0.0 "
14221422 else if (isOption(tpe, types.tail)) q " _root_.scala.None "
1423+ else if (isValueClass(tpe)) q " new $tpe( ${genNullValue(valueClassValueType(tpe) :: types)}) "
14231424 else if (tpe <:< typeOf[mutable.BitSet ]) q " new _root_.scala.collection.mutable.BitSet "
14241425 else if (tpe <:< typeOf[collection.BitSet ]) withNullValueFor(tpe)(q " _root_.scala.collection.immutable.BitSet.empty " )
14251426 else if (tpe <:< typeOf[mutable.LongMap [? ]]) q " ${scalaCollectionCompanion(tpe)}.empty[ ${typeArg1(tpe)}] "
@@ -1452,7 +1453,6 @@ object JsonCodecMaker {
14521453 case _ => cannotFindValueCodecError(tpe)
14531454 }
14541455 } else if (tpe.typeSymbol.isModuleClass) q " ${tpe.typeSymbol.asClass.module}"
1455- else if (isValueClass(tpe)) q " new $tpe( ${genNullValue(valueClassValueType(tpe) :: types)}) "
14561456 else if (tpe <:< typeOf[AnyRef ]) q " null "
14571457 else q " null.asInstanceOf[ $tpe] "
14581458 }
@@ -1638,6 +1638,16 @@ object JsonCodecMaker {
16381638 } else if (tpe =:= definitions.DoubleTpe || tpe =:= typeOf[java.lang.Double ]) {
16391639 if (isStringified) q " in.readStringAsDouble() "
16401640 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+ }
16411651 } else if (tpe =:= typeOf[java.util.UUID ]) q " in.readUUID( $default) "
16421652 else if (tpe =:= typeOf[Duration ]) q " in.readDuration( $default) "
16431653 else if (tpe =:= typeOf[Instant ]) q " in.readInstant( $default) "
@@ -1653,17 +1663,7 @@ object JsonCodecMaker {
16531663 else if (tpe =:= typeOf[ZonedDateTime ]) q " in.readZonedDateTime( $default) "
16541664 else if (tpe =:= typeOf[ZoneId ]) q " in.readZoneId( $default) "
16551665 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)) {
16671667 val tpe1 = valueClassValueType(tpe)
16681668 q " new $tpe( ${genReadVal(tpe1 :: types, genNullValue(tpe1 :: types), isStringified, EmptyTree )}) "
16691669 } else if (isOption(tpe, types.tail)) {
0 commit comments