3

I'm using scalaxb to generate Scala code from an XSD. (In particular I am using the maven scalaxb plugin.) The code generation phase runs without a hitch, and eyeballing them, the generated scala files look good. But when I try to compile I am getting a stack overflow on:

[ERROR] error: java.lang.StackOverflowError
[INFO]  at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:754)
[INFO]  at scala.tools.nsc.matching.MatrixAdditions$MatchMatrixOptimizer$lxtt$2$.transform(MatrixAdditions.scala:113)
[INFO]  at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:845)
[INFO]  at scala.tools.nsc.matching.MatrixAdditions$MatchMatrixOptimizer$lxtt$2$.transform(MatrixAdditions.scala:113)
[INFO]  at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:837)
[INFO]  at scala.tools.nsc.matching.MatrixAdditions$MatchMatrixOptimizer$lxtt$2$.transform(MatrixAdditions.scala:113)
[INFO]  at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:821)
[INFO]  at scala.tools.nsc.matching.MatrixAdditions$MatchMatrixOptimizer$lxtt$2$.transform(MatrixAdditions.scala:113)
[INFO]  at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:821)
[INFO]  at scala.tools.nsc.matching.MatrixAdditions$MatchMatrixOptimizer$lxtt$2$.transform(MatrixAdditions.scala:113)
[INFO]  at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:821)
[INFO]  at scala.tools.nsc.matching.MatrixAdditions$MatchMatrixOptimizer$lxtt$2$.transform(MatrixAdditions.scala:113)

...

[INFO]  at scala.collection.mutable.ListBuffer$$anon$1.foreach(ListBuffer.scala:311)
[INFO]  at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:294)
[INFO]  at scala.tools.nsc.transform.ExplicitOuter$Phase.run(ExplicitOuter.scala:539)
[INFO]  at scala.tools.nsc.Global$Run.compileSources(Global.scala:949)
[INFO]  at scala.tools.nsc.Global$Run.compile(Global.scala:1034)
[INFO]  at scala.tools.nsc.Main$.process(Main.scala:106)
[INFO]  at scala.tools.nsc.Main$.main(Main.scala:123)
[INFO]  at scala.tools.nsc.Main.main(Main.scala)
[INFO]  ... 6 more
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------

The xsd I am using has been tested and works with jaxb.

Scala version is 2.9.0-1, scalaxb is 0.6.2.

Eugene Yokota
  • 94,654
  • 45
  • 215
  • 319
Jim
  • 556
  • 4
  • 12
  • This should be reported either to scalaxb project or scala. Not enough info to answer this as a genrally useful question. – Eugene Yokota Sep 20 '11 at 15:47
  • 1
    Hi Eugene -- turns out not actually a problem. The compiler just needed a whole lot stack space for the code generated for my particular xsd. '-Xss2048k' solved my problem. I'd answer my own question or tag it as scalaxb, but StackOverflow tells me I lack the reputation to do either. – Jim Sep 20 '11 at 16:13
  • I posted your answer as a community wiki. – Eugene Yokota Sep 20 '11 at 19:59

2 Answers2

5

So, according to the OP, the problem was resolved by putting -Xss2048k in the jvmArg.

Eugene Yokota
  • 94,654
  • 45
  • 215
  • 319
0

In case of sbt and complex xsd I have to increase the stack size to 4M during sbt compile by using this command:

sbt -J-Xss4M compile
Lykov
  • 5
  • 1