用Kotlin和akka-testkit测试akka演员

我正在玩阿卡和科特林。 我正在使用akka java API。 Actor类正常工作。 但是我不能用Akka-testkit来实现测试用例。

这是我的测试用例,

fun testWordCount() { object : JavaTestKit(system) { init { val masterActor = system.actorOf(Props.create(WordCountActor.WordCountMaster::class.java), "master") masterActor.tell(WordCountActor.StartCounting("src/main/resources/", 5), testActor) val wcs = expectMsgClass(JavaTestKit.duration("5 seconds"), WordCountActor.WordCountSuccess::class.java) object : JavaTestKit.Within(JavaTestKit.duration("5 seconds")) { override fun run() { Assert.assertEquals(20, wcs.result.size) } } } } } 

我得到下面的错误 –

 Error:(39, 17) Kotlin: [Internal Error] org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Error generating constructors of class null with kind IMPLEMENTATION Cause: Error generating constructors of class null with kind IMPLEMENTATION File being compiled and position: (39,17) in /Users/kunalkanojia/Workspace/fun/kotlin_word_count/src/test/kotlin/WordCountActorTest.kt PsiElement: object : JavaTestKit.Within(JavaTestKit.duration("20 seconds")) { override fun run() { Assert.assertEquals(20, wcs.result.size.toLong()) } } 

我是Kotlin新手,可能是什么问题?

这是kotlin编译器中的一个bug,它在1.0.4分支中修复,修复了快照版本中的可用性。 对于kotlin 1.0.3,您可以使用https://youtrack.jetbrains.com/issue/KT-11833的解决方法