scalaxb 生成的代码在编译期间导致堆栈溢出

发布于 2024-12-05 10:12:43 字数 2176 浏览 0 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

万人眼中万个我 2024-12-12 10:12:43

因此,根据 OP,通过将 -Xss2048k 放入 jvmArg 中解决了问题。

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

天荒地未老 2024-12-12 10:12:43

如果是 sbt 和复杂的 xsd,我必须在 sbt 编译期间使用以下命令将堆栈大小增加到 4M:

sbt -J-Xss4M compile

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文