Skip to content

Commit 90ad32b

Browse files
authored
Merge of #539
2 parents 07b0b2a + 7d1ec83 commit 90ad32b

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Scala Steward: Reformat with scalafmt 3.9.7
2+
57db10a7468db8214022fc1337eb557d9f2ac0a9

.scalafmt.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version=3.7.17
1+
version=3.9.7
22
runner.dialect=scala213source3

src/main/scala/scalapb/json4s/JsonFormat.scala

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ class Printer private (config: Printer.PrinterConfig) {
324324
case PInt(v) => v.toString
325325
case PLong(v) => v.toString
326326
case PString(v) => v
327-
case v =>
327+
case v =>
328328
throw new JsonFormatException(s"Unexpected value for key: $v")
329329
}
330330
val value = if (valueDescriptor.protoType.isTypeMessage) {
@@ -396,7 +396,7 @@ class Printer private (config: Printer.PrinterConfig) {
396396
m.companion.asInstanceOf[GeneratedMessageCompanion[A]]
397397
) match {
398398
case Some(f) => f(this, m)
399-
case None =>
399+
case None =>
400400
val b = List.newBuilder[JField]
401401
val descriptor = m.companion.scalaDescriptor
402402
b.sizeHint(descriptor.fields.size)
@@ -450,7 +450,7 @@ class Printer private (config: Printer.PrinterConfig) {
450450
case PEnum(e) =>
451451
config.formatRegistry.getEnumWriter(e.containingEnum) match {
452452
case Some(writer) => writer(this, e)
453-
case None =>
453+
case None =>
454454
if (config.isFormattingEnumsAsNumber || e.isUnrecognized)
455455
JInt(e.number)
456456
else JString(e.name)
@@ -460,11 +460,11 @@ class Printer private (config: Printer.PrinterConfig) {
460460
case PInt(v) => JInt(v)
461461
case PLong(v) => formatLong(v, fd.protoType, formattingLongAsNumber)
462462
case PDouble(v) => JDouble(v)
463-
case PFloat(v) =>
463+
case PFloat(v) =>
464464
if (!v.isNaN && !v.isInfinite) JDecimal(BigDecimal.decimal(v))
465465
else JDouble(v)
466-
case PBoolean(v) => JBool(v)
467-
case PString(v) => JString(v)
466+
case PBoolean(v) => JBool(v)
467+
case PString(v) => JString(v)
468468
case PByteString(v) =>
469469
JString(Base64Variants.getDefaultVariant.encode(v.toByteArray))
470470
case _: PMessage | PRepeated(_) | PEmpty =>
@@ -581,7 +581,7 @@ class Parser private (config: Parser.ParserConfig) {
581581
case ScalaType.Int => PInt(java.lang.Integer.valueOf(key))
582582
case ScalaType.Long => PLong(java.lang.Long.valueOf(key))
583583
case ScalaType.String => PString(key)
584-
case _ =>
584+
case _ =>
585585
throw new RuntimeException(
586586
s"Unsupported type for key for ${fd.name}"
587587
)
@@ -618,7 +618,7 @@ class Parser private (config: Parser.ParserConfig) {
618618
cmp.asInstanceOf[GeneratedMessageCompanion[GeneratedMessage]]
619619
) match {
620620
case Some(p) => p(this, value).toPMessage
621-
case None =>
621+
case None =>
622622
value match {
623623
case JObject(fields) =>
624624
val usedOneofs = mutable.Set[OneofDescriptor]()
@@ -987,7 +987,7 @@ object JsonFormat {
987987
case (Type.TYPE_BOOL, JString("true")) => PBoolean(true)
988988
case (Type.TYPE_BOOL, JString("false")) => PBoolean(false)
989989
case (Type.TYPE_STRING, JString(s)) => PString(s)
990-
case (Type.TYPE_BYTES, JString(s)) =>
990+
case (Type.TYPE_BYTES, JString(s)) =>
991991
PByteString(
992992
ByteString.copyFrom(Base64Variants.getDefaultVariant.decode(s))
993993
)
@@ -1072,7 +1072,7 @@ object JsonFormat {
10721072
case "NaN" => PDouble(Double.NaN)
10731073
case "Infinity" => PDouble(Double.PositiveInfinity)
10741074
case "-Infinity" => PDouble(Double.NegativeInfinity)
1075-
case v =>
1075+
case v =>
10761076
try {
10771077
val bd = new java.math.BigDecimal(v)
10781078
if (bd.compareTo(MAX_DOUBLE) > 0 || bd.compareTo(MIN_DOUBLE) < 0) {
@@ -1081,7 +1081,7 @@ object JsonFormat {
10811081
PDouble(bd.doubleValue)
10821082
} catch {
10831083
case e: JsonFormatException => throw e
1084-
case e: Exception =>
1084+
case e: Exception =>
10851085
throw new JsonFormatException("Not a double value: " + v)
10861086
}
10871087
}
@@ -1091,7 +1091,7 @@ object JsonFormat {
10911091
case "NaN" => PFloat(Float.NaN)
10921092
case "Infinity" => PFloat(Float.PositiveInfinity)
10931093
case "-Infinity" => PFloat(Float.NegativeInfinity)
1094-
case v =>
1094+
case v =>
10951095
try {
10961096
val value = java.lang.Double.parseDouble(v)
10971097
if (
@@ -1103,7 +1103,7 @@ object JsonFormat {
11031103
PFloat(value.toFloat)
11041104
} catch {
11051105
case e: JsonFormatException => throw e
1106-
case e: Exception =>
1106+
case e: Exception =>
11071107
throw new JsonFormatException("Not a float value: " + v)
11081108
}
11091109
}

0 commit comments

Comments
 (0)