未能用gradle建立kotlin项目

时间:2017-09-26 16:25:29

标签: gradle kotlin

克隆此项目时https://github.com/artem-zinnatullin/droidcon-nyc-2017-puzzlers.git

项目无法构建,我收到了错误消息。 这似乎是rxjava lib中的问题,但我找不到。

类MediumRxPuzzler2 {

// What will be printed and why?
@Test
fun puzzler() {
    val observer = object : Observer<Int> {
        override fun onSubscribe(d: Disposable) = Unit

        override fun onNext(t: Int) {
            println("onNext $t")
        }

        override fun onComplete() {
            println("onComplete")
        }

        override fun onError(e: Throwable) {
            println("onError $e")
        }
    }

    Observable.just(1).subscribe(observer)
    Observable.just(2).subscribe(observer)
}

// What will be printed and why?
@Test
fun `same puzzler?`() {
    val observer = object : DefaultObserver<Int>() {
        override fun onNext(t: Int) {
            println("onNext $t")
        }

        override fun onComplete() {
            println("onComplete")
        }

        override fun onError(e: Throwable) {
            println("onError $e")
        }
    }

    Observable.just(1).subscribe(observer)
    Observable.just(2).subscribe(observer)
}

}

Error:Kotlin: [Internal Error] java.lang.IllegalStateException: java.io.FileNotFoundException: D:\droidcon-nyc-2017-puzzlers\puzzlers\build\classes\java\test\com\lyft\droidconnyc2017\puzzlers\rxjava\wth\WthRxPuzzler1$is there any difference 1?$inner$1.class (The filename, directory name, or volume label syntax is incorrect)
        at org.jetbrains.kotlin.codegen.CompilationErrorHandler.lambda$static$0(CompilationErrorHandler.java:24)
        at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:74)
        at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.generatePackage(KotlinCodegenFacade.java:99)
        at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.doGenerateFiles(KotlinCodegenFacade.java:77)
        at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:44)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:442)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules(KotlinToJVMBytecodeCompiler.kt:153)
        at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:154)
        at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:58)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:103)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:51)
        at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92)
        at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$1.invoke(CompileServiceImpl.kt:380)
        at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$1.invoke(CompileServiceImpl.kt:96)
        at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:889)
        at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:96)
        at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
        at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:916)
        at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:888)
        at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:378)
        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:498)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
        at sun.rmi.transport.Transport$1.run(Transport.java:200)
        at sun.rmi.transport.Transport$1.run(Transport.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
        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)
    Caused by: java.io.FileNotFoundException: D:\droidcon-nyc-2017-puzzlers\puzzlers\build\classes\java\test\com\lyft\droidconnyc2017\puzzlers\rxjava\wth\WthRxPuzzler1$is there any difference 1?$inner$1.class (The filename, directory name, or volume label syntax is incorrect)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at com.intellij.openapi.util.io.FileUtil.writeToFile(FileUtil.java:1282)
        at com.intellij.openapi.util.io.FileUtil.writeToFile(FileUtil.java:1276)
        at com.intellij.openapi.util.io.FileUtil.writeToFile(FileUtil.java:1261)
        at org.jetbrains.kotlin.cli.common.output.outputUtils.OutputUtilsKt.writeAll(outputUtils.kt:32)
        at org.jetbrains.kotlin.cli.common.output.outputUtils.OutputUtilsKt.writeAll(outputUtils.kt:42)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.writeOutput(KotlinToJVMBytecodeCompiler.kt:99)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.access$writeOutput(KotlinToJVMBytecodeCompiler.kt:68)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$createOutputFilesFlushingCallbackIfPossible$1.invoke(KotlinToJVMBytecodeCompiler.kt:108)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$createOutputFilesFlushingCallbackIfPossible$1.invoke(KotlinToJVMBytecodeCompiler.kt:68)
        at org.jetbrains.kotlin.codegen.state.GenerationStateKt$GenerationStateEventCallback$1.invoke(GenerationState.kt:250)
        at org.jetbrains.kotlin.codegen.state.GenerationStateKt$GenerationStateEventCallback$1.invoke(GenerationState.kt:249)
        at org.jetbrains.kotlin.codegen.state.GenerationState.afterIndependentPart(GenerationState.kt:206)
        at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:67)
        ... 35 more

1 个答案:

答案 0 :(得分:0)

这只是Windows上的错误 https://youtrack.jetbrains.com/issue/KT-17438