JetBrains / kotlin-native

Kotlin/Native infrastructure
Apache License 2.0
7.03k stars 566 forks source link

Error:compilation failed: null #1806

Closed chinacharis closed 6 years ago

chinacharis commented 6 years ago

Information:Building target 'ucstar_basesdk' for architecture 'x86_64' using 'Simulator - iOS 11.4' sdk Information:Running script 'Compile Kotlin/Native'

Configure project : feature GRADLE_METADATA is not enabled: publication is disabled Task :checkKonanCompiler Task :compileKonanUcstar_basesdkIos_x64 Error:compilation failed: null

  • Source files: KotlinNativeFramework.kt, AppGlobals.kt, PlatformDependence.kt, ContentValues.kt, Context.kt, SharedPreferences.kt, CharArrayBuffer.kt, ....
  • Compiler version info: Konan: 0.8 / Kotlin: 1.2.70
  • Output kind: FRAMEWORK exception: kotlin.KotlinNullPointerException at org.jetbrains.kotlin.backend.common.lower.IrBuildingTransformer.getBuilder(LowerUtils.kt:121) at org.jetbrains.kotlin.backend.konan.lower.PostInlineLowering$lower$1.visitClassReference(PostInlineLowering.kt:47) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitClassReference(IrElementTransformerVoid.kt:198) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitClassReference(IrElementTransformerVoid.kt:24) at org.jetbrains.kotlin.ir.expressions.impl.IrClassReferenceImpl.accept(IrClassReferenceImpl.kt:54) at org.jetbrains.kotlin.ir.expressions.IrExpression$DefaultImpls.transform(IrExpression.kt:27) at org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBase.transform(IrExpressionBase.kt:23) at org.jetbrains.kotlin.ir.expressions.impl.IrCallWithIndexedArgumentsBase.transformChildren(IrCallWithIndexedArgumentsBase.kt:70) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoidKt.transformChildrenVoid(IrElementTransformerVoid.kt:267) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildrenVoid(IrElementTransformerVoid.kt:262) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildren(IrElementTransformerVoid.kt:25) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitExpression(IrElementTransformerVoid.kt:109) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitMemberAccess(IrElementTransformerVoid.kt:163) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitEnumConstructorCall(IrElementTransformerVoid.kt:176) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitEnumConstructorCall(IrElementTransformerVoid.kt:177) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitEnumConstructorCall(IrElementTransformerVoid.kt:24) at org.jetbrains.kotlin.ir.expressions.impl.IrEnumConstructorCallImpl.accept(IrEnumConstructorCallImpl.kt:62) at org.jetbrains.kotlin.ir.expressions.IrExpression$DefaultImpls.transform(IrExpression.kt:27) at org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBase.transform(IrExpressionBase.kt:23) at org.jetbrains.kotlin.ir.declarations.impl.IrEnumEntryImpl.transformChildren(IrEnumEntryImpl.kt:85) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoidKt.transformChildrenVoid(IrElementTransformerVoid.kt:267) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildrenVoid(IrElementTransformerVoid.kt:262) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildren(IrElementTransformerVoid.kt:25) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitDeclaration(IrElementTransformerVoid.kt:46) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitEnumEntry(IrElementTransformerVoid.kt:74) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitEnumEntry(IrElementTransformerVoid.kt:75) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitEnumEntry(IrElementTransformerVoid.kt:24) at org.jetbrains.kotlin.ir.declarations.impl.IrEnumEntryImpl.accept(IrEnumEntryImpl.kt:76) at org.jetbrains.kotlin.ir.declarations.IrDeclaration$DefaultImpls.transform(IrDeclaration.kt:36) at org.jetbrains.kotlin.ir.declarations.impl.IrDeclarationBase.transform(IrDeclarationBase.kt:25) at org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl.transformChildren(IrClassImpl.kt:111) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoidKt.transformChildrenVoid(IrElementTransformerVoid.kt:267) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildrenVoid(IrElementTransformerVoid.kt:262) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildren(IrElementTransformerVoid.kt:25) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitDeclaration(IrElementTransformerVoid.kt:46) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitClass(IrElementTransformerVoid.kt:49) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitClass(IrElementTransformerVoid.kt:50) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitClass(IrElementTransformerVoid.kt:24) at org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl.accept(IrClassImpl.kt:100) at org.jetbrains.kotlin.ir.declarations.IrDeclaration$DefaultImpls.transform(IrDeclaration.kt:36) at org.jetbrains.kotlin.ir.declarations.impl.IrDeclarationBase.transform(IrDeclarationBase.kt:25) at org.jetbrains.kotlin.ir.declarations.impl.IrFileImpl.transformChildren(IrFileImpl.kt:84) at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoidKt.transformChildrenVoid(IrElementTransformerVoid.kt:267) at org.jetbrains.kotlin.backend.konan.lower.PostInlineLowering.lower(PostInlineLowering.kt:43) at org.jetbrains.kotlin.backend.konan.KonanLower$lowerModule$5.invoke(KonanLower.kt:68) at org.jetbrains.kotlin.backend.konan.KonanLower$lowerModule$5.invoke(KonanLower.kt:31) at org.jetbrains.kotlin.backend.konan.PhaseManager$phase$$inlined$with$lambda$1.invoke(KonanPhases.kt:139) at org.jetbrains.kotlin.backend.konan.PhaseManager$phase$$inlined$with$lambda$1.invoke(KonanPhases.kt:118) at org.jetbrains.kotlin.konan.util.UtilKt.profileIf(Util.kt:34) at org.jetbrains.kotlin.backend.konan.PhaseManager.phase$backend_native_compiler(KonanPhases.kt:138) at org.jetbrains.kotlin.backend.konan.KonanLower.lowerModule(KonanLower.kt:67) at org.jetbrains.kotlin.backend.konan.KonanLower.lower(KonanLower.kt:37) at org.jetbrains.kotlin.backend.konan.KonanDriverKt$runTopLevelPhases$4$1.invoke(KonanDriver.kt:92) at org.jetbrains.kotlin.backend.konan.KonanDriverKt$runTopLevelPhases$4$1.invoke(KonanDriver.kt) at org.jetbrains.kotlin.backend.konan.PhaseManager$phase$$inlined$with$lambda$1.invoke(KonanPhases.kt:139) at org.jetbrains.kotlin.backend.konan.PhaseManager$phase$$inlined$with$lambda$1.invoke(KonanPhases.kt:118) at org.jetbrains.kotlin.konan.util.UtilKt.profileIf(Util.kt:34) at org.jetbrains.kotlin.backend.konan.PhaseManager.phase$backend_native_compiler(KonanPhases.kt:138) at org.jetbrains.kotlin.backend.konan.KonanDriverKt$runTopLevelPhases$4.invoke(KonanDriver.kt:91) at org.jetbrains.kotlin.backend.konan.KonanDriverKt$runTopLevelPhases$4.invoke(KonanDriver.kt) at org.jetbrains.kotlin.backend.konan.PhaseManager$phase$$inlined$with$lambda$1.invoke(KonanPhases.kt:139) at org.jetbrains.kotlin.backend.konan.PhaseManager$phase$$inlined$with$lambda$1.invoke(KonanPhases.kt:118) at org.jetbrains.kotlin.konan.util.UtilKt.profileIf(Util.kt:34) at org.jetbrains.kotlin.backend.konan.PhaseManager.phase$backend_native_compiler(KonanPhases.kt:138) at org.jetbrains.kotlin.backend.konan.KonanDriverKt.runTopLevelPhases(KonanDriver.kt:90) at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:75) at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:42) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:95) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:50) at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:88) at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:66) at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:34) at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMainNoExit(CLITool.kt:180) at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMain(CLITool.kt:171) at org.jetbrains.kotlin.cli.bc.K2Native$Companion$main$1.invoke(K2Native.kt:197) at org.jetbrains.kotlin.cli.bc.K2Native$Companion$main$1.invoke(K2Native.kt:188) at org.jetbrains.kotlin.konan.util.UtilKt.profileIf(Util.kt:34) at org.jetbrains.kotlin.konan.util.UtilKt.profile(Util.kt:29) at org.jetbrains.kotlin.cli.bc.K2Native$Companion.main(K2Native.kt:190) at org.jetbrains.kotlin.cli.bc.K2NativeKt.main(K2Native.kt:202) at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:27) Task :compileKonanUcstar_basesdkIos_x64 FAILED FAILURE: Build failed with an exception.
  • What went wrong: Execution failed for task ':compileKonanUcstar_basesdkIos_x64'. Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  • Get more help at https://help.gradle.org BUILD FAILED in 1m 22s 2 actionable tasks: 2 executed Error:Build failed in 1 m 25 s 26 ms

too many codes, can not find crash reason...

chinacharis commented 6 years ago

enum class UserInfoFieldEnum private constructor(val value: Int, val fieldType: KClass<*>?) { undefined(-1, null as KClass?), Name(3, String::class), AVATAR(4, String::class), SIGNATURE(5, String::class), GENDER(6, Int::class), EMAIL(7, String::class), BIRTHDAY(8, String::class), MOBILE(9, String::class), EXTEND(10, String::class);

companion object {

    fun typeOfValue(pI: Int): UserInfoFieldEnum {
        val v1aUIFEnum: Array<UserInfoFieldEnum> = UserInfoFieldEnum.values()
        val v2I = v1aUIFEnum.size

        for (v3I in 0 until v2I) {
            val v4UIFEnum = v1aUIFEnum[v3I]
            if (v4UIFEnum.value == pI) {
                return v4UIFEnum
            }
        }

        return undefined
    }
}

}

this enum lead this crash, why?

sbogolepov commented 6 years ago

Shall be fixed with #1810