`java.lang.ArrayIndexOutOfBoundsException` while compilation
doohochang opened this issue · 4 comments
doohochang commented
Environment
Scala: 3.3.2-RC1 / 3.3.1 / 3.3.0
Bloop: 1.5.13
SBT: 1.9.7
Report
error id: KxtMDOtvVJMpYD/+am347g==
### Bloop error:
Unexpected error when compiling common: java.lang.ArrayIndexOutOfBoundsException: Index 3134 out of bounds for length 0
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.selectSpan(ExtractSemanticDB.scala:401)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse(ExtractSemanticDB.scala:243)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse$$anonfun$13(ExtractSemanticDB.scala:221)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse(ExtractSemanticDB.scala:221)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverseAnnotsOfDefinition$$anonfun$1(ExtractSemanticDB.scala:133)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverseAnnotsOfDefinition(ExtractSemanticDB.scala:133)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse(ExtractSemanticDB.scala:139)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse$$anonfun$11(ExtractSemanticDB.scala:207)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse(ExtractSemanticDB.scala:207)
at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.apply(Trees.scala:1767)
at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.apply(Trees.scala:1767)
at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1725)
at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.traverseChildren(Trees.scala:1768)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse(ExtractSemanticDB.scala:181)
at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.apply(Trees.scala:1767)
at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.apply(Trees.scala:1767)
at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.fold$1(Trees.scala:1633)
at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.apply(Trees.scala:1635)
at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1666)
at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.traverseChildren(Trees.scala:1768)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse(ExtractSemanticDB.scala:281)
at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.apply(Trees.scala:1767)
at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.apply(Trees.scala:1767)
at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1660)
at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.traverseChildren(Trees.scala:1768)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse(ExtractSemanticDB.scala:281)
at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.apply(Trees.scala:1767)
at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.apply(Trees.scala:1767)
at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1721)
at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.traverseChildren(Trees.scala:1768)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse(ExtractSemanticDB.scala:184)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse$$anonfun$11(ExtractSemanticDB.scala:207)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse(ExtractSemanticDB.scala:207)
at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.apply(Trees.scala:1767)
at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.apply(Trees.scala:1767)
at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1725)
at dotty.tools.dotc.ast.Trees$Instance$TreeTraverser.traverseChildren(Trees.scala:1768)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse(ExtractSemanticDB.scala:181)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse$$anonfun$1(ExtractSemanticDB.scala:145)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.traverse(ExtractSemanticDB.scala:145)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB$Extractor.extract(ExtractSemanticDB.scala:79)
at dotty.tools.dotc.semanticdb.ExtractSemanticDB.run(ExtractSemanticDB.scala:52)
at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:327)
at scala.collection.immutable.List.map(List.scala:250)
at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:331)
at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321)
at dotty.tools.dotc.Run.runPhases$1(Run.scala:262)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270)
at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:71)
at dotty.tools.dotc.Run.compileUnits(Run.scala:279)
at dotty.tools.dotc.Run.compileSources(Run.scala:194)
at dotty.tools.dotc.Run.compile(Run.scala:179)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:136)
at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.compileSources$1(BloopHighLevelCompiler.scala:133)
at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$7(BloopHighLevelCompiler.scala:159)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$1(BloopHighLevelCompiler.scala:71)
at bloop.tracing.NoopTracer$.trace(BraveTracer.scala:53)
at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.timed$1(BloopHighLevelCompiler.scala:70)
at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$6(BloopHighLevelCompiler.scala:159)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at monix.eval.internal.TaskRunLoop$.startFull(TaskRunLoop.scala:81)
at monix.eval.internal.TaskRestartCallback.syncOnSuccess(TaskRestartCallback.scala:101)
at monix.eval.internal.TaskRestartCallback.onSuccess(TaskRestartCallback.scala:74)
at monix.eval.internal.TaskExecuteOn$AsyncRegister$$anon$1.run(TaskExecuteOn.scala:71)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
#### Short summary:
Unexpected error when compiling common: java.lang.ArrayIndexOutOfBoundsException: Index 3134 out of ...
tgodzik commented
Thanks for reporting! Any chance you could share the problematic code? If not we will only be able to add a condition, but not fix the underlying issue.
tgodzik commented
The code changed quite heavily around that parts, we should wait for 3.3.3 to confirm that the exception is no longer being thrown.
doohochang commented
Thank you for checking it.
I will see if the issue is resolved after Scala 3.3.3 or 3.4.x release and report the result.
doohochang commented
I tested our project with Scala 3.4.0-RC1, and the issue has been resolved 🎉