This is my first post, so before I start trying to report bugs: thanks for a great framework!
Anyway, the last line in the following code throws a ClassCastException using Lift-2.1-RC1 on scala-2.8.0-final
import net.liftweb.json
import json.DefaultFormats
import json.Extraction.decompose
implicit val formats = DefaultFormats
case class Map1(m: Map[String, String])
val map1 = Map1(Map("a" -> "b", "c" -> "d"))
val json1 = decompose(map1)
assert(json1.extract[Map1] == map1)
case class Map2(m: Map[String, List[String]])
val map2 = Map2(Map("a" -> List("b"), "c" -> List("d")))
val json2 = decompose(map2)
assert(json2.extract[Map2] == map2)
(The Maps are contained in case classes because of the "Root object can't yet be List or Map (needs a feature from Scala 2.8)" issue).
Writing a custom Serializer for Map2 doesn't work, as the exception appears to be thrown before any custom deserialization is even looked up.
The stack trace reads as follows:
Exception in thread "main" net.liftweb.json.MappingException: unknown error
at net.liftweb.json.Extraction$.extract(Extraction.scala:43)
at net.liftweb.json.JsonAST$JValue.extract(JsonAST.scala:288)
at net.enhancededitions.paymenttracker.scratch.Scratch$.main(Scratch.scala:23)
at net.enhancededitions.paymenttracker.scratch.Scratch.main(Scratch.scala)
Caused by: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
at net.liftweb.json.Meta$Reflection$.types$1(Meta.scala:228)
at net.liftweb.json.Meta$Reflection$.typeConstructors(Meta.scala:235)
at net.liftweb.json.Meta$.mkContainer$1(Meta.scala:89)
at net.liftweb.json.Meta$.fieldMapping$1(Meta.scala:109)
at net.liftweb.json.Meta$.toArg$1(Meta.scala:117)
at net.liftweb.json.Meta$$anonfun$constructors$1$1$$anonfun$apply$1.apply(Meta.scala:83)
at net.liftweb.json.Meta$$anonfun$constructors$1$1$$anonfun$apply$1.apply(Meta.scala:82)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:206)
at scala.collection.immutable.List.map(List.scala:45)
at net.liftweb.json.Meta$$anonfun$constructors$1$1.apply(Meta.scala:82)
at net.liftweb.json.Meta$$anonfun$constructors$1$1.apply(Meta.scala:81)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:206)
at scala.collection.immutable.List.map(List.scala:45)
at net.liftweb.json.Meta$.constructors$1(Meta.scala:81)
at net.liftweb.json.Meta$$anonfun$mappingOf$1.apply(Meta.scala:122)
at net.liftweb.json.Meta$$anonfun$mappingOf$1.apply(Meta.scala:122)
at net.liftweb.json.Meta$Memo.memoize(Meta.scala:141)
at net.liftweb.json.Meta$.mappingOf(Meta.scala:122)
at net.liftweb.json.Extraction$.extract(Extraction.scala:176)
at net.liftweb.json.Extraction$.extract0(Extraction.scala:172)
at net.liftweb.json.Extraction$.extract(Extraction.scala:40)
... 3 more
Sorry not to propose a solution: the code in Extraction.scala is a little beyond me, I'm afraid. I don't seem to have permission to raise tickets in Assembla, else I would have raised this there.
Many thanks,
Guy.
Sorry no. Barring some catastrophic bug 2.1 is what is in rc3
> --
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to lif...@googlegroups.com.
> To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
>
On Sep 21, 10:53 pm, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> Sorry no. Barring some catastrophic bug 2.1 is what is in rc3Oh well, never mind. It's great that you've got 2.1 with the sbt +
Scala 2.8 support out so soon after 2.0: thank you.
Back to snapshots for me: am I right in thinking that the nightly
builds are made on the 2.x-2.8_devel branch in git?
Cheers,
Guy.
--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.