Skip to content

Commit

Permalink
Use converters in Predef instead of explicit casts.
Browse files Browse the repository at this point in the history
  • Loading branch information
arashi01 committed Jan 24, 2021
1 parent a28e75b commit 1544046
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/scala/io.circe.config/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ package object config {
private[config] def jsonToConfigValue(json: Json): ConfigValue =
json.fold(
ConfigValueFactory.fromAnyRef(null),
boolean => ConfigValueFactory.fromAnyRef(boolean.asInstanceOf[java.lang.Boolean]),
boolean => ConfigValueFactory.fromAnyRef(Predef.boolean2Boolean(boolean)),
number =>
number.toLong match {
case Some(long) => ConfigValueFactory.fromAnyRef(long.asInstanceOf[java.lang.Long])
case None => ConfigValueFactory.fromAnyRef(number.toDouble.asInstanceOf[java.lang.Double])
case Some(long) => ConfigValueFactory.fromAnyRef(Predef.long2Long(long))
case None => ConfigValueFactory.fromAnyRef(Predef.double2Double(number.toDouble))
},
str => ConfigValueFactory.fromAnyRef(str),
arr => ConfigValueFactory.fromIterable(arr.map(jsonToConfigValue).asJava),
Expand Down

0 comments on commit 1544046

Please sign in to comment.