1

我的 scala 项目使用sbt-extra和 sbt.version 0.11.2 和 scala 版本 2.9.1。当我尝试编译我的项目( )时,我对以下堆栈跟踪./sbt compile感到奇怪:java.util.NoSuchElementException: head of empty list

at scala.collection.immutable.Nil$.head(List.scala:371)
at scala.collection.immutable.Nil$.head(List.scala:368)
at scala.tools.nsc.symtab.Types$class.map2Conserve(Types.scala:4980)
at scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:13)
at scala.tools.nsc.symtab.Types$class.map2Conserve(Types.scala:4981)
at scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:13)
at scala.tools.nsc.symtab.Types$TypeMap.mapOverArgs(Types.scala:3207)
at scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:3114)
at scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:3522)
at scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:3389)
at scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:3130)
at scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:3522)
at scala.tools.nsc.symtab.Types$Type.asSeenFrom(Types.scala:546)
at scala.tools.nsc.symtab.Types$Type.memberInfo(Types.scala:560)
at xsbt.API.defDef(API.scala:182)
at xsbt.API.xsbt$API$$definition(API.scala:258)
at xsbt.API$$anonfun$xsbt$API$$processDefinitions$1.apply(API.scala:244)
at xsbt.API$$anonfun$xsbt$API$$processDefinitions$1.apply(API.scala:244)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:200)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:200)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:34)
at scala.collection.mutable.ArrayOps.foreach(ArrayOps.scala:38)
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:200)
at scala.collection.mutable.ArrayOps.flatMap(ArrayOps.scala:38)
at xsbt.API.xsbt$API$$processDefinitions(API.scala:244)
at xsbt.API$$anonfun$mkStructure$3.apply(API.scala:242)
at xsbt.API$$anonfun$mkStructure$3.apply(API.scala:242)
at xsbt.Message$$anon$1.apply(Message.scala:8)
at xsbti.SafeLazy$$anonfun$apply$1.apply(SafeLazy.scala:8)
at xsbti.SafeLazy$Impl._t(SafeLazy.scala:20)
at xsbti.SafeLazy$Impl.get(SafeLazy.scala:24)
at xsbt.API$$anonfun$xsbt$API$$forceStructures$1.apply(API.scala:94)
at xsbt.API$$anonfun$xsbt$API$$forceStructures$1.apply(API.scala:94)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at xsbt.API.xsbt$API$$forceStructures(API.scala:94)
at xsbt.API$ApiPhase.processScalaUnit(API.scala:46)
at xsbt.API$ApiPhase.processUnit(API.scala:37)
at xsbt.API$ApiPhase$$anonfun$run$1.apply(API.scala:33)
at xsbt.API$ApiPhase$$anonfun$run$1.apply(API.scala:33)
at scala.collection.Iterator$class.foreach(Iterator.scala:660)
at scala.collection.mutable.ListBuffer$$anon$1.foreach(ListBuffer.scala:316)
at xsbt.API$ApiPhase.run(API.scala:33)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:953)
at scala.tools.nsc.Global$Run.compile(Global.scala:1038)
at xsbt.CompilerInterface.run(CompilerInterface.scala:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:57)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:29)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:25)
at sbt.AggressiveCompile$$anonfun$5.compileScala$1(AggressiveCompile.scala:67)
at sbt.AggressiveCompile$$anonfun$5.apply(AggressiveCompile.scala:79)
at sbt.AggressiveCompile$$anonfun$5.apply(AggressiveCompile.scala:57)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:21)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:19)
at sbt.inc.Incremental$.cycle(Incremental.scala:33)
at sbt.inc.Incremental$.compile(Incremental.scala:20)
at sbt.inc.IncrementalCompile$.apply(Compile.scala:17)
at sbt.AggressiveCompile.compile2(AggressiveCompile.scala:87)
at sbt.AggressiveCompile.compile1(AggressiveCompile.scala:41)
at sbt.AggressiveCompile.apply(AggressiveCompile.scala:28)
at sbt.Compiler$.apply(Compiler.scala:107)
at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:479)
at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:479)
at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:473)
at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:473)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:41)
at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$11.apply(Structure.scala:295)
at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$11.apply(Structure.scala:295)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$5.work(System.scala:67)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:221)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:221)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:227)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:221)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:221)
at sbt.CompletionService$$anon$1$$anon$2.call(CompletionService.scala:26)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)

它没有提到我的任何代码行,这是一个运行时异常,所以我猜 sbt compile 任务本身出了点问题,但我不知道是什么。

提前致谢,

编辑

与 scala 2.9.2 和 sbt 0.12.2 相同的错误。我尝试清洁,但没有奏效。

4

1 回答 1

1

该错误可能是在 scala 2.10 中修复的编译器错误。

它可能是 SI-5044 或 SI-5862。

我升级到 scala 2.10.1 并且工作正常。

于 2013-09-06T21:41:01.943 回答