I created scala case class with 100 fields +- , When I'm trying to build the project (with gradle) , I'm getting error:
Cause: java.lang.StackOverflowError
at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:698)
at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5396)
at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5423)
I'm using scala 2.11 , and found that in the past, there was a limitation of 22 fields. but it was fixed.
So why the build is failed? (I tried to increase -Xss20m , but it didn't help)
What worked in my case was setting -Xss in build.gradle script like this:
compileScala {
options.forkOptions.jvmArgs += "-Xss4m"
}
Then I am able to compile app with case class having 100+ fields using scala 2.11.12. All the other settings (in IntelliJ Idea menus) were not effective.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With