编译期间未捕获的异常:java.lang.AssertionError

时间:2015-04-15 17:58:16

标签: scala sbt jodatime

这是我学习scala的第二天,所以我无法自信地说,但它看起来像编译器错误,不是吗?

我的项目中有一个代码文件:

import org.joda.time.DateTime
import org.joda.time.DateTimeZone

object CheckCompilation {
  val time = new DateTime(DateTimeZone.forID("Europe/Minsk"))
}

build.sbt:

name := "ScalaCompilerCheck"

version := "1.0"

libraryDependencies += "joda-time" % "joda-time" % "2.7"

sbt compile输出:

OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
[info] Loading project definition from /home/jofsey/IdeaProjects/ScalaCompilerCheck/project
[info] Set current project to ScalaCompilerCheck (in build file:/home/jofsey/IdeaProjects/ScalaCompilerCheck/)
[info] Updating {file:/home/jofsey/IdeaProjects/ScalaCompilerCheck/}scalacompilercheck...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 1 Scala source and 1 Java source to /home/jofsey/IdeaProjects/ScalaCompilerCheck/target/scala-2.10/classes...
[warn] Class org.joda.convert.FromString not found - continuing with a stub.
[warn] Class org.joda.convert.ToString not found - continuing with a stub.
[warn] Class org.joda.convert.ToString not found - continuing with a stub.
[warn] Class org.joda.convert.FromString not found - continuing with a stub.
[warn] Class org.joda.convert.ToString not found - continuing with a stub.
[error]
[error]      while compiling: /home/jofsey/IdeaProjects/ScalaCompilerCheck/src/main/scala/CheckCompilation.scala
[error]         during phase: refchecks
[error]      library version: version 2.10.4
[error]     compiler version: version 2.10.4
[error]   reconstructed args: -bootclasspath /usr/lib/jvm/java-8-openjdk/jre/lib/resources.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/rt.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jsse.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jce.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/charsets.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jfr.jar:/usr/lib/jvm/java-8-openjdk/jre/classes:/home/jofsey/.sbt/boot/scala-2.10.4/lib/scala-library.jar -classpath /home/jofsey/IdeaProjects/ScalaCompilerCheck/target/scala-2.10/classes:/home/jofsey/.ivy2/cache/joda-time/joda-time/jars/joda-time-2.7.jar
[error]
[error]   last tree to typer: This(object CheckCompilation)
[error]               symbol: object CheckCompilation (flags: <module>)
[error]    symbol definition: class CheckCompilation extends AnyRef
[error]                  tpe: CheckCompilation.type
[error]        symbol owners: object CheckCompilation -> package <empty>
[error]       context owners: object CheckCompilation -> package <empty>
[error]
[error] == Enclosing template or block ==
[error]
[error] Template( // val <local CheckCompilation>: <notype> in object CheckCompilation, tree.tpe=CheckCompilation.type
[error]   "java.lang.Object" // parents
[error]   ValDef(
[error]     private
[error]     "_"
[error]     <tpt>
[error]     <empty>
[error]   )
[error]   // 3 statements
[error]   DefDef( // def <init>(): CheckCompilation.type in object CheckCompilation
[error]     <method>
[error]     "<init>"
[error]     []
[error]     List(Nil)
[error]     <tpt> // tree.tpe=CheckCompilation.type
[error]     Block( // tree.tpe=Unit
[error]       Apply( // def <init>(): Object in class Object, tree.tpe=Object
[error]         CheckCompilation.super."<init>" // def <init>(): Object in class Object, tree.tpe=()Object
[error]         Nil
[error]       )
[error]       ()
[error]     )
[error]   )
[error]   ValDef( // private[this] val time: org.joda.time.DateTime in object CheckCompilation
[error]     private <local> <triedcooking>
[error]     "time "
[error]     <tpt> // tree.tpe=org.joda.time.DateTime
[error]     Apply( // def <init>(x$1: org.joda.time.DateTimeZone): org.joda.time.DateTime in class DateTime, tree.tpe=org.joda.time.DateTime
[error]       new org.joda.time.DateTime."<init>" // def <init>(x$1: org.joda.time.DateTimeZone): org.joda.time.DateTime in class DateTime, tree.tpe=(x$1: org.joda.time.DateTimeZone)org.joda.time.DateTime
[error]       Apply( // def forID(x$1: String): org.joda.time.DateTimeZone in object DateTimeZone, tree.tpe=org.joda.time.DateTimeZone
[error]         "org"."joda"."time"."DateTimeZone"."forID" // def forID(x$1: String): org.joda.time.DateTimeZone in object DateTimeZone, tree.tpe=(x$1: String)org.joda.time.DateTimeZone
[error]         "Europe/Minsk"
[error]       )
[error]     )
[error]   )
[error]   DefDef( // val time: org.joda.time.DateTime in object CheckCompilation
[error]     <method> <stable> <accessor>
[error]     "time"
[error]     []
[error]     Nil
[error]     <tpt> // tree.tpe=org.joda.time.DateTime
[error]     CheckCompilation.this."time " // private[this] val time: org.joda.time.DateTime in object CheckCompilation, tree.tpe=org.joda.time.DateTime
[error]   )
[error] )
[error]
[error] == Expanded type of tree ==
[error]
[error] ThisType(object CheckCompilation)
[error]
[error] uncaught exception during compilation: java.lang.AssertionError
java.lang.AssertionError: assertion failed: org.joda.convert.FromString
        at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1212)
        at scala.reflect.internal.Symbols$TypeSymbol.isNonBottomSubClass(Symbols.scala:2821)
        at scala.reflect.internal.AnnotationInfos$AnnotationInfo.matches(AnnotationInfos.scala:295)
        at scala.reflect.internal.AnnotationInfos$Annotatable$class.dropOtherAnnotations(AnnotationInfos.scala:65)
        at scala.reflect.internal.AnnotationInfos$Annotatable$class.hasAnnotation(AnnotationInfos.scala:50)
        at scala.reflect.internal.Symbols$Symbol.hasAnnotation(Symbols.scala:112)
        at scala.reflect.internal.Symbols$Symbol.isDeprecated(Symbols.scala:723)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.checkDeprecated(RefChecks.scala:1385)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transformSelect(RefChecks.scala:1648)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:1814)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:96)
        at scala.reflect.internal.Trees$class.itransform(Trees.scala:1219)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2897)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:1841)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:96)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:2900)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:2900)
        at scala.collection.immutable.List.loop$1(List.scala:170)
        at scala.collection.immutable.List.mapConserve(List.scala:186)
        at scala.reflect.api.Trees$Transformer.transformTrees(Trees.scala:2900)
        at scala.reflect.internal.Trees$class.itransform(Trees.scala:1219)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2897)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:1841)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:96)
        at scala.reflect.internal.Trees$$anonfun$itransform$1.apply(Trees.scala:1229)
        at scala.reflect.internal.Trees$$anonfun$itransform$1.apply(Trees.scala:1228)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2936)
        at scala.reflect.internal.Trees$class.itransform(Trees.scala:1227)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2897)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:1841)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transformStat(RefChecks.scala:1337)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer$$anonfun$transformStats$1.apply(RefChecks.scala:1268)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer$$anonfun$transformStats$1.apply(RefChecks.scala:1268)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
        at scala.collection.immutable.List.foreach(List.scala:318)
        at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251)
        at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transformStats(RefChecks.scala:1268)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transformStats(RefChecks.scala:96)
        at scala.reflect.internal.Trees$class.itransform(Trees.scala:1276)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2897)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:1841)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:96)
        at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2904)
        at scala.reflect.internal.Trees$$anonfun$itransform$4.apply(Trees.scala:1280)
        at scala.reflect.internal.Trees$$anonfun$itransform$4.apply(Trees.scala:1279)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2936)
        at scala.reflect.internal.Trees$class.itransform(Trees.scala:1278)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2897)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:1841)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:96)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:2900)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:2900)
        at scala.collection.immutable.List.loop$1(List.scala:170)
        at scala.collection.immutable.List.mapConserve(List.scala:186)
        at scala.reflect.api.Trees$Transformer.transformTrees(Trees.scala:2900)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.eliminateModuleDefs(RefChecks.scala:1316)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transformStat(RefChecks.scala:1335)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer$$anonfun$transformStats$1.apply(RefChecks.scala:1268)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer$$anonfun$transformStats$1.apply(RefChecks.scala:1268)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
        at scala.collection.immutable.List.foreach(List.scala:318)
        at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251)
        at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transformStats(RefChecks.scala:1268)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transformStats(RefChecks.scala:96)
        at scala.reflect.internal.Trees$$anonfun$itransform$7.apply(Trees.scala:1298)
        at scala.reflect.internal.Trees$$anonfun$itransform$7.apply(Trees.scala:1298)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2936)
        at scala.reflect.internal.Trees$class.itransform(Trees.scala:1297)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2897)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:1841)
        at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:96)
        at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:227)
        at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:464)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:431)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:431)
        at scala.collection.Iterator$class.foreach(Iterator.scala:727)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
        at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:431)
        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:116)
        at xsbt.CachedCompiler0.run(CompilerInterface.scala:95)
        at xsbt.CompilerInterface.run(CompilerInterface.scala:26)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:101)
        at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:47)
        at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)
        at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply$mcV$sp(MixedAnalyzingCompiler.scala:51)
        at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:51)
        at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:51)
        at sbt.compiler.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:75)
        at sbt.compiler.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:50)
        at sbt.compiler.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:65)
        at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
        at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
        at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:66)
        at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:64)
        at sbt.inc.IncrementalCommon.cycle(IncrementalCommon.scala:31)
        at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:62)
        at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:61)
        at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:89)
        at sbt.inc.Incremental$.compile(Incremental.scala:61)
        at sbt.inc.IncrementalCompile$.apply(Compile.scala:54)
        at sbt.compiler.IC$.compileInternal(IncrementalCompiler.scala:160)
        at sbt.compiler.IC$.incrementalCompile(IncrementalCompiler.scala:138)
        at sbt.Compiler$.compile(Compiler.scala:128)
        at sbt.Compiler$.compile(Compiler.scala:114)
        at sbt.Defaults$.sbt$Defaults$$compileIncrementalTaskImpl(Defaults.scala:814)
        at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:805)
        at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:803)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
        at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
        at sbt.std.Transform$$anon$4.work(System.scala:63)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
        at sbt.Execute.work(Execute.scala:235)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
[error] (compile:compileIncremental) java.lang.AssertionError: assertion failed: org.joda.convert.FromString
[error] Total time: 2 s, completed Apr 15, 2015 8:43:34 PM

1 个答案:

答案 0 :(得分:9)

fromString取决于joda-convert。将其添加到您的build.sbt文件中:

libraryDependencies ++= Seq(
  "joda-time" % "joda-time" % "2.7",
  "org.joda" % "joda-convert" % "1.7"
)