scalaxb 生成的代码在编译期间导致堆栈溢出
我正在使用 scalaxb 从 XSD 生成 Scala 代码。 (特别是我正在使用 Maven scalaxb 插件。)代码生成阶段运行顺利,并且观察它们,生成的 scala 文件看起来不错。但是当我尝试编译时,出现堆栈溢出:
[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] ------------------------------------------------------------------------
我正在使用的 xsd 已经过测试并且可以与 jaxb 一起使用。
Scala版本是2.9.0-1,scalaxb是0.6.2。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
因此,根据 OP,通过将
-Xss2048k
放入jvmArg
中解决了问题。So, according to the OP, the problem was resolved by putting
-Xss2048k
in thejvmArg
.如果是 sbt 和复杂的 xsd,我必须在 sbt 编译期间使用以下命令将堆栈大小增加到 4M:
In case of sbt and complex xsd I have to increase the stack size to 4M during
sbt compile
by using this command: