Open EindbaasExpress opened 2 years ago
Reading json generated by write throws NullPointerException with Scala3, the same code with Scala2.13 runs without problems.
build.sbt
scalaVersion := "3.1.0" // 2.13.7 works correct, 3.1.0 crashes libraryDependencies ++= Seq("com.lihaoyi" %% "upickle" % "1.4.2")
Code reproducing the problem
import upickle.default._ object ShowCrash { case class Node(name: String, kids: Vector[Node]) implicit val nodeRW: ReadWriter[Node] = macroRW[Node] val ndb = Node("b", Vector.empty) val nda = Node("a", Vector(ndb)) def main(args: Array[String]): Unit = { println(s"nda: $nda") val json = write(nda) println(s"json: $json") val node = read[Node](json) println(s"node: $node") } }
Fails with:
nda: Node(a,Vector(Node(b,Vector()))) json: {"name":"a","kids":[{"name":"b","kids":[]}]} [error] (run-main-1) java.lang.NullPointerException [error] java.lang.NullPointerException [error] at ujson.CharParser.parseNested(CharParser.scala:401)
ID: 371 Original Author: otto-ringhofer
Reading json generated by write throws NullPointerException with Scala3, the same code with Scala2.13 runs without problems.
build.sbt
Code reproducing the problem
Fails with:
ID: 371 Original Author: otto-ringhofer