(以下更新信息)
我正在为现有项目的构建配置添加sbt-assembly
,现在当我编译时,我得到以下错误,我无法解析(路径和名称已修改/缩写):< / p>
[error] while compiling: .../src/.../utilities/Utilities.scala
[error] during phase: jvm
[error] library version: version 2.10.3
[error] compiler version: version 2.10.3
[error] reconstructed args: -classpath ...
[error]
[error] last tree to typer: TypeTree(trait ProjectActivityProperties)
[error] symbol: trait ProjectActivityProperties in package properties (flags: <interface> abstract <java> <trait>)
[error] symbol definition: abstract interface ProjectActivityProperties extends Object
[error] tpe: com.project.model.elements.properties.ProjectActivityProperties
[error] symbol owners: trait ProjectActivityProperties -> package properties
[error] context owners: constructor ProjectActivityProperties -> trait ProjectActivityProperties -> package properties
[error]
[error] == Enclosing template or block ==
[error]
[error] DefDef( // def <init>(): com.project.model.elements.properties.ProjectActivityProperties in trait ProjectActivityProperties
[error] <method> <java>
[error] "<init>"
[error] []
[error] List(Nil)
[error] <tpt> // tree.tpe=com.project.model.elements.properties.ProjectActivityProperties
[error] "_"
[error] )
[error]
[error] == Expanded type of tree ==
[error]
[error] TypeRef(
[error] TypeSymbol(
[error] abstract interface ProjectActivityProperties extends Object
[error] )
[error] )
[error]
[error] uncaught exception during compilation: java.lang.AssertionError
[trace] Stack trace suppressed: run last root/compile:compile for the full output.
[error] (root/compile:compile) java.lang.AssertionError: assertion failed: List(object package$Opt, object package$Opt)
导致错误的接口很奇怪,因为它继承自另一个接口。删除此继承可以解决问题,我可以成功构建工作程序集。但是,存在另一个也从父接口继承并且不会导致问题的接口。
我的问题是为什么这可以解决问题(当其他类似的例子仍然存在时),或者什么是真正的潜在问题?
我正在使用一些遗留代码,我宁愿不修改工作代码库只是为了更改构建配置。
更新
虽然这在过去非常可重复,但在尝试不同的Scala版本和其他配置更改之后,它的发生频率要低得多。编译时似乎发生异常,这似乎表明这是编译器的一个问题(?)
为完整起见,last root/compile:compile
的最终输出为:
java.lang.AssertionError: assertion failed: List(object package$Opt, object package$Opt)
at scala.reflect.internal.Symbols$Symbol.suchThat(Symbols.scala:1669)
at scala.reflect.internal.Symbols$ClassSymbol.companionModule0(Symbols.scala:2979)
at scala.reflect.internal.Symbols$ClassSymbol.companionModule(Symbols.scala:2982)
at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genClass(GenASM.scala:1369)
at scala.tools.nsc.backend.jvm.GenASM$AsmPhase.run(GenASM.scala:119)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1583)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1557)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1553)
at scala.tools.nsc.Global$Run.compile(Global.scala:1662)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:123)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:99)
at xsbt.CompilerInterface.run(CompilerInterface.scala:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:102)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:48)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:98)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:98)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:98)
at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:159)
at sbt.compiler.AggressiveCompile$$anonfun$3.compileScala$1(AggressiveCompile.scala:97)
at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:142)
at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:86)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:38)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:36)
at sbt.inc.Incremental$.cycle(Incremental.scala:73)
at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:33)
at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:32)
at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:41)
at sbt.inc.Incremental$.compile(Incremental.scala:32)
at sbt.inc.IncrementalCompile$.apply(Compile.scala:26)
at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:150)
at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:70)
at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:45)
at sbt.Compiler$.apply(Compiler.scala:70)
at sbt.Defaults$.sbt$Defaults$$compileTaskImpl(Defaults.scala:736)
at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:730)
at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:730)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:244)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
[error] (root/compile:compile) java.lang.AssertionError: assertion failed: List(object package$Opt, object package$Opt)