hitting some scala limitations
Fixing salaxb so it can compile Footprint XML Specification.
First I had to account for the fact that in XML Schema, you could legally have elements having the same name as long as they are not at the top level. This required me to change the parsing a little bit. Next, I was fixing the simple content handling, I ran into the following error message by Scala compiler:
[scalac] tests/tmp/footprint.scala:255: error: value Tuple23 is not a member of package scala [scalac] case class VolunteerOpportunity(volunteerOpportunityID: Option[String], [scalac] ^ [scalac] one error found
This is because Scala supports only up to Tuple22
.
The case class in question looks like this:
case class VolunteerOpportunity(volunteerOpportunityID: Option[String], sponsoringOrganizationIDs: Option[SponsoringOrganizationIDs], volunteerHubOrganizationIDs: Option[VolunteerHubOrganizationIDs], title: Option[String], abstractValue: Option[String], volunteersNeeded: Option[Int], rsvpCount: Option[Int], dateTimeDurations: Option[DateTimeDurations], locations: Option[Locations], paid: Option[String], audienceTags: Option[AudienceTags], categoryTags: Option[CategoryTags], minimumAge: Option[Int], sexRestrictedTo: Option[String], skills: Option[String], contactName: Option[String], contactPhone: Option[String], contactEmail: Option[String], detailURL: Option[String], language: Option[String], description: Option[String], lastUpdated: Option[DateTimeOlsonDefaultPacific], expires: Option[DateTimeOlsonDefaultPacific]) extends DataModel { }
I haven't thought of workaround for this issue yet, besides modifying the input schema.
So I took one element out, and ran it again.
Next problem.
[scalac] java.lang.OutOfMemoryError: Java heap space [scalac] at scala.collection.immutable.List.$colon$colon(List.scala:68) [scalac] at scala.tools.nsc.matching.MatrixAdditions$MatrixExhaustiveness$ExhaustivenessChecker$$anonfun$5$$anonfun$apply$2$$anonfun$apply$3.apply(MatrixAdditions.scala:216) [scalac] at scala.tools.nsc.matching.MatrixAdditions$MatrixExhaustiveness$ExhaustivenessChecker$$anonfun$5$$anonfun$apply$2$$anonfun$apply$3.apply(MatrixAdditions.scala:216) [scalac] at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:238) [scalac] at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:238) [scalac] at scala.collection.LinearSeqLike$class.foreach(LinearSeqLike.scala:97) [scalac] at scala.collection.immutable.List.foreach(List.scala:46) [scalac] at scala.collection.TraversableLike$class.map(TraversableLike.scala:238) [scalac] at scala.collection.immutable.List.map(List.scala:46) [scalac] at scala.tools.nsc.matching.MatrixAdditions$MatrixExhaustiveness$ExhaustivenessChecker$$anonfun$5$$anonfun$apply$2.apply(MatrixAdditions.scala:216) [scalac] at scala.tools.nsc.matching.MatrixAdditions$MatrixExhaustiveness$ExhaustivenessChecker$$anonfun$5$$anonfun$apply$2.apply(MatrixAdditions.scala:216) [scalac] at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:259) [scalac] at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:259) [scalac] at scala.collection.LinearSeqLike$class.foreach(LinearSeqLike.scala:97) [scalac] at scala.collection.immutable.List.foreach(List.scala:46) [scalac] at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:259) [scalac] at scala.collection.immutable.List.flatMap(List.scala:46) [scalac] at scala.tools.nsc.matching.MatrixAdditions$MatrixExhaustiveness$ExhaustivenessChecker$$anonfun$5.apply(MatrixAdditions.scala:216) [scalac] at scala.tools.nsc.matching.MatrixAdditions$MatrixExhaustiveness$ExhaustivenessChecker$$anonfun$5.apply(MatrixAdditions.scala:212) [scalac] at scala.collection.LinearSeqLike$class.foldRight(LinearSeqLike.scala:168) [scalac] at scala.collection.immutable.List.foldRight(List.scala:46) [scalac] at scala.collection.LinearSeqLike$class.foldRight(LinearSeqLike.scala:168) [scalac] at scala.collection.immutable.List.foldRight(List.scala:46) [scalac] at scala.collection.LinearSeqLike$class.foldRight(LinearSeqLike.scala:168) [scalac] at scala.collection.immutable.List.foldRight(List.scala:46) [scalac] at scala.collection.LinearSeqLike$class.foldRight(LinearSeqLike.scala:168) [scalac] at scala.collection.immutable.List.foldRight(List.scala:46) [scalac] at scala.collection.LinearSeqLike$class.foldRight(LinearSeqLike.scala:168) [scalac] at scala.collection.immutable.List.foldRight(List.scala:46) [scalac] at scala.collection.LinearSeqLike$class.foldRight(LinearSeqLike.scala:168) [scalac] at scala.collection.immutable.List.foldRight(List.scala:46) [scalac] at scala.tools.nsc.matching.MatrixAdditions$MatrixExhaustiveness$ExhaustivenessChecker.inexhaustives(MatrixAdditions.scala:212)
I don't know exactly, but I am guessing the case class with 22 parameters managed to memory overflow the JVM, which is capped at 512M (I hope it's not the 64M).
Here's what I did to work around the issue:
$ export JAVA_OPTS="-Xmx1G -Xms16M -Xss16M" $ scalac -sourcepath tests/tmp/ -d tests/tmp/ tests/tmp/footprint.scala tests/tmp/footprintTest.scala $ java -classpath tests/tmp/:$SCALA_HOME/lib/scala-library.jar FootprintTest
That worked.