Skip to content

Commit

Permalink
FIX Forgot for a moment Long is not nullable :/
Browse files Browse the repository at this point in the history
  • Loading branch information
ilmirons committed Feb 14, 2025
1 parent 5c54741 commit 8350e79
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ast/shared/src/main/scala/jawn/ast/JValue.scala
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ case class DoubleNum(n: Double) extends JNum {
case class DeferLong(s: String) extends JNum {

lazy val nOpt: Option[Long] = Try(util.parseLong(s)).toOption
lazy val n: Long = nOpt.orNull.asInstanceOf[Long] // would be better to throw an exception here?
lazy val n: Long = nOpt.getOrElse(throw new InvalidNumException(s))

final override def getInt: Option[Int] = nOpt.map(_.toInt)
final override def getLong: Option[Long] = nOpt
Expand Down

0 comments on commit 8350e79

Please sign in to comment.