2017-04-02 68 views
2

昨天我正在我的代碼庫,當服務已行將就木,我跑我的單元測試對我的代碼的時候,突然我看到這個的想法日誌:IDEA IllegalStateException異常:與科特林運行JUnit測試

Error:Kotlin: [Internal Error] java.lang.IllegalStateException: Service is dying at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Dying.get(CompileService.kt:60) at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Dying.get(CompileService.kt:59) at org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner.compileWithDaemon(JpsKotlinCompilerRunner.kt:127) at org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner.compileWithDaemonOrFallback(JpsKotlinCompilerRunner.kt:100) at org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner.compileWithDaemonOrFallback(JpsKotlinCompilerRunner.kt:35) at org.jetbrains.kotlin.compilerRunner.KotlinCompilerRunner.runCompiler(KotlinCompilerRunner.kt:115) at org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner.runK2JvmCompiler(JpsKotlinCompilerRunner.kt:65) at org.jetbrains.kotlin.jps.build.KotlinBuilder.compileToJvm(KotlinBuilder.kt:740) at org.jetbrains.kotlin.jps.build.KotlinBuilder.doCompileModuleChunk(KotlinBuilder.kt:458) at org.jetbrains.kotlin.jps.build.KotlinBuilder.doBuild(KotlinBuilder.kt:264) at org.jetbrains.kotlin.jps.build.KotlinBuilder.build(KotlinBuilder.kt:181) at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1282) at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:956) at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1028) at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:915) at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:741) at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:387) at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:195) at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138) at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:295) at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125) at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:238) at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:44) 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)

這是四月份來自JetBrains的傻瓜笑話嗎?

我從來沒有見過這個。 killall java和一個IDEA重新啓動解決了這個問題,我無法重現這一點。在編譯Kotlin代碼時,是否有這樣的記錄(我沒有在Google上找到任何匹配)或IDEA中的一次性故障? 這個錯誤是什麼意思?

注意我跑了單元測試是一個簡單的試驗探索,我認爲這是無關緊要的位置:

internal fun fetchAsListWithSiblings(): List<Message<T>> { 
    val first = this 
    var currentMsg = first 
    val result = mutableListOf(currentMsg) 
    while(currentMsg.next.isPresent) { 
     val next = currentMsg.next.get() 
     currentMsg = next 
     result.add(next) 
    } 
    return result 
} 


@Test 
fun shouldFetchSiblingsWhenFetchSiblingsIsCalledWithMultipleSiblings() { 
    val expected = listOf("foo", "bar", "baz") 
    val messages = Message.createMultiple(expected) 

    assertThat(messages.fetchAsListWithSiblings().map { it.payload }).isEqualTo(expected) 
} 
+0

「_這是四月份來自JetBrains的傻瓜笑話嗎?」並不是提問的重要部分。 –

回答

5

這是衆所周知的問題 - 在並行編譯開始的比賽條件。通常重複構建解決它。以下是YouTrack中的相關issue KT-15562。這個問題應該在Kotlin 1.1.2發佈中得到解決。