IDE版本
IntelliJ IDEA 2018.2.2
解決方案
更新IDE版本到 2019.1
詳細報錯資訊
Error:Kotlin: [Internal Error] java.lang.IllegalStateException: Backend Internal error: Exception during code generation
Cause: Back-end (JVM) Internal error: Couldn’t inline method call ‘post’ into
local final fun io.ktor.routing.Route.(): kotlin.Unit defined in userRoutes
{
get("/list") {
val users = client.getDatabase(dbName)
.getCollection(collectionName)
.find()
.toList()
call.respond(HttpStatusCode.OK, users)
}
post("/add") {request ->
val user = User(userName = request.userName,
password = request.password,
email = request.email)
client.getDatabase(dbName)
.insertOne(user)
call.respond(HttpStatusCode.OK)
Cause: Lambda inlining UserControllerKt$userRoutes$1
2
:
c
o
u
l
d
n
′
t
i
e
m
h
a
C
s
v
k
(
L
/
r
p
P
x
;
U
R
q
K
2: couldn't inline method call Cause: invoke (Lio/ktor/util/pipeline/PipelineContext;LCreateUserRequest;Lkotlin/coroutines/Continuation;LUserControllerKt
2:couldn′tinlinemethodcallCause:invoke(Lio/ktor/util/pipeline/PipelineContext;LCreateUserRequest;Lkotlin/coroutines/Continuation;LUserControllerKtuserRoutes
1
)
j
g
O
b
I
N
E
M
B
284
W
D
A
S
T
V
.
285
w
286
3
<
>
f
5
4
287
289
6
7
290
8
G
1;)Ljava/lang/Object;: L0 LINENUMBER 284 L0 NEW User DUP ACONST_NULL ALOAD 2 INVOKEVIRTUAL CreateUserRequest.getUserName ()Ljava/lang/String; L1 LINENUMBER 285 L1 ALOAD 2 INVOKEVIRTUAL CreateUserRequest.getPassword ()Ljava/lang/String; L2 LINENUMBER 286 L2 ALOAD 2 INVOKEVIRTUAL CreateUserRequest.getEmail ()Ljava/lang/String; ICONST_1 ACONST_NULL L3 LINENUMBER 284 L3 INVOKESPECIAL User.<init> (Ljava/util/UUID;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V ASTORE 5 L4 LINENUMBER 287 L4 L5 LINENUMBER 289 L5 L6 LINENUMBER 287 L6 L7 LINENUMBER 290 L7 L8 LINENUMBER 287 L8 GETSTATIC UserControllerKt
1;)Ljava/lang/Object;:L0LINENUMBER284L0NEWUserDUPACONSTNULLALOAD2INVOKEVIRTUALCreateUserRequest.getUserName()Ljava/lang/String;L1LINENUMBER285L1ALOAD2INVOKEVIRTUALCreateUserRequest.getPassword()Ljava/lang/String;L2LINENUMBER286L2ALOAD2INVOKEVIRTUALCreateUserRequest.getEmail()Ljava/lang/String;ICONST1ACONSTNULLL3LINENUMBER284L3INVOKESPECIALUser.<init>(Ljava/util/UUID;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)VASTORE5L4LINENUMBER287L4L5LINENUMBER289L5L6LINENUMBER287L6L7LINENUMBER290L7L8LINENUMBER287L8GETSTATICUserControllerKtuserRoutes$1
2.KaTeX parse error: Can't use function '$' in math mode at position 5: this$̲0 : LUserContro…$this
0 : LUserControllerKt
0:LUserControllerKtuserRoutes
F
1; GETFIELD UserControllerKt
1;GETFIELDUserControllerKtuserRoutes
1.client
y
9
z
10
H
11
metadata : Lkotlin/reflect/KProperty; ASTORE 8 NOP L9 ALOAD 6 INVOKEINTERFACE kotlin/Lazy.getValue ()Ljava/lang/Object; NOP GOTO L10 L10 CHECKCAST org/litote/kmongo/coroutine/CoroutineClient L11 LINENUMBER 287 L11 GETSTATIC UserControllerKt
metadata:Lkotlin/reflect/KProperty;ASTORE8NOPL9ALOAD6INVOKEINTERFACEkotlin/Lazy.getValue()Ljava/lang/Object;NOPGOTOL10L10CHECKCASTorg/litote/kmongo/coroutine/CoroutineClientL11LINENUMBER287L11GETSTATICUserControllerKtuserRoutes$1
1.collectionName : Ljava/lang/String;
ASTORE 7
NOP
L13
ICONST_0
ISTORE 8
L14
LINENUMBER 291 L14
ALOAD 6
INVOKEVIRTUAL org/litote/kmongo/coroutine/CoroutineDatabase.getDatabase ()Lcom/mongodb/reactivestreams/client/MongoDatabase;
ALOAD 7
LDC LUser;.class
INVOKEINTERFACE com/mongodb/reactivestreams/client/MongoDatabase.getCollection (Ljava/lang/String;Ljava/lang/Class;)Lcom/mongodb/reactivestreams/client/MongoCollection;
DUP
LDC “database.getCollection(c\u2026e, TDocument::class.java)”
INVOKESTATIC kotlin/jvm/internal/Intrinsics.checkExpressionValueIsNotNull (Ljava/lang/Object;Ljava/lang/String;)V
INVOKESTATIC org/litote/kmongo/coroutine/CoroutineCollectionKt.getCoroutine (Lcom/mongodb/reactivestreams/client/MongoCollection;)Lorg/litote/kmongo/coroutine/CoroutineCollection;
GOTO L15
L15
L16
LINENUMBER 289 L16
ALOAD 5
ACONST_NULL
ALOAD 0
ICONST_2
INVOKESTATIC kotlin/jvm/internal/InlineMarker.mark (I)V
INVOKESTATIC org/litote/kmongo/coroutine/CoroutineCollection.insertOne
17
292
18
19
293
20
21
default (Lorg/litote/kmongo/coroutine/CoroutineCollection;Ljava/lang/Object;Lcom/mongodb/client/model/InsertOneOptions;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; ICONST_1 INVOKESTATIC kotlin/jvm/internal/InlineMarker.mark (I)V POP L17 LINENUMBER 292 L17 ALOAD 1 ASTORE 6 NOP L18 ICONST_0 ISTORE 7 L19 LINENUMBER 293 L19 ALOAD 6 INVOKEINTERFACE io/ktor/util/pipeline/PipelineContext.getContext ()Ljava/lang/Object; CHECKCAST io/ktor/application/ApplicationCall NOP GOTO L20 L20 ASTORE 6 L21 LINENUMBER 292 L21 GETSTATIC io/ktor/http/HttpStatusCode.Companion : Lio/ktor/http/HttpStatusCode
default(Lorg/litote/kmongo/coroutine/CoroutineCollection;Ljava/lang/Object;Lcom/mongodb/client/model/InsertOneOptions;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;ICONST1INVOKESTATICkotlin/jvm/internal/InlineMarker.mark(I)VPOPL17LINENUMBER292L17ALOAD1ASTORE6NOPL18ICONST0ISTORE7L19LINENUMBER293L19ALOAD6INVOKEINTERFACEio/ktor/util/pipeline/PipelineContext.getContext()Ljava/lang/Object;CHECKCASTio/ktor/application/ApplicationCallNOPGOTOL20L20ASTORE6L21LINENUMBER292L21GETSTATICio/ktor/http/HttpStatusCode.Companion:Lio/ktor/http/HttpStatusCodeCompanion;
INVOKEVIRTUAL io/ktor/http/HttpStatusCode
22
Companion.getOK ()Lio/ktor/http/HttpStatusCode; ASTORE 7 ICONST_3 INVOKESTATIC kotlin/jvm/internal/InlineMarker.mark (I)V ACONST_NULL ASTORE 8 NOP L22 ALOAD 8 INSTANCEOF io/ktor/response/ApplicationResponseFunctionsKt
Companion.getOK()Lio/ktor/http/HttpStatusCode;ASTORE7ICONST3INVOKESTATICkotlin/jvm/internal/InlineMarker.mark(I)VACONSTNULLASTORE8NOPL22ALOAD8INSTANCEOFio/ktor/response/ApplicationResponseFunctionsKtrespond
Q
23
1 IFEQ L23 ALOAD 8 CHECKCAST io/ktor/response/ApplicationResponseFunctionsKt
1IFEQL23ALOAD8CHECKCASTio/ktor/response/ApplicationResponseFunctionsKtrespond
1 ASTORE 9 ALOAD 9 GETFIELD io/ktor/response/ApplicationResponseFunctionsKt
1ASTORE9ALOAD9GETFIELDio/ktor/response/ApplicationResponseFunctionsKtrespond
−
2147483648
1.label : I LDC -2147483648 IAND IFEQ L23 ALOAD 9 DUP GETFIELD io/ktor/response/ApplicationResponseFunctionsKt
1.label:ILDC−2147483648IANDIFEQL23ALOAD9DUPGETFIELDio/ktor/response/ApplicationResponseFunctionsKtrespond
1.label : I LDC -2147483648 ISUB PUTFIELD io/ktor/response/ApplicationResponseFunctionsKt
1.label:ILDC−2147483648ISUBPUTFIELDio/ktor/response/ApplicationResponseFunctionsKtrespond
24
1.label : I GOTO L24 L23 NEW UserControllerKt
1.label:IGOTOL24L23NEWUserControllerKtuserRoutes
special
inlined
inlinedpostTyped$1
1lambda
1 DUP ALOAD 8 INVOKESPECIAL UserControllerKt
1DUPALOAD8INVOKESPECIALUserControllerKtuserRoutes
1.<init> (Lkotlin/coroutines/Continuation;)V ASTORE 9 L24 ALOAD 9 GETFIELD UserControllerKt
1.<init>(Lkotlin/coroutines/Continuation;)VASTORE9L24ALOAD9GETFIELDUserControllerKtuserRoutes
25
294
1.result : Ljava/lang/Object; ASTORE 10 INVOKESTATIC kotlin/coroutines/intrinsics/IntrinsicsKt.getCOROUTINE_SUSPENDED ()Ljava/lang/Object; L25 LINENUMBER 294 L25 ASTORE 11 ALOAD 9 GETFIELD UserControllerKt
1.result:Ljava/lang/Object;ASTORE10INVOKESTATICkotlin/coroutines/intrinsics/IntrinsicsKt.getCOROUTINESUSPENDED()Ljava/lang/Object;L25LINENUMBER294L25ASTORE11ALOAD9GETFIELDUserControllerKtuserRoutes
261
27
28
26
1.label : I TABLESWITCH 0: L26 1: L27 default: L28 L26 ALOAD 10 DUP INSTANCEOF kotlin/Result
1.label:ITABLESWITCH0:L261:L27default:L28L26ALOAD10DUPINSTANCEOFkotlin/ResultFailure
IFEQ L29
CHECKCAST kotlin/Result
Failure GETFIELD kotlin/Result
FailureGETFIELDkotlin/ResultFailure.exception : Ljava/lang/Throwable;
ATHROW
L29
POP
ISTORE 12
L30
LINENUMBER 295 L30
INVOKEINTERFACE io/ktor/application/ApplicationCall.getResponse ()Lio/ktor/response/ApplicationResponse;
INVOKEINTERFACE io/ktor/response/ApplicationResponse.getPipeline ()Lio/ktor/response/ApplicationSendPipeline;
ALOAD 9
PUTFIELD UserControllerKt$userRoutes
1lambda$1.L
0 : Ljava/lang/Object; ALOAD 9 ALOAD 7 PUTFIELD UserControllerKt
0:Ljava/lang/Object;ALOAD9ALOAD7PUTFIELDUserControllerKtuserRoutes
1 : Ljava/lang/Object; ALOAD 9 ICONST_1 PUTFIELD UserControllerKt
1:Ljava/lang/Object;ALOAD9ICONST1PUTFIELDUserControllerKtuserRoutes
31
32
13
33
1.label : I INVOKEVIRTUAL io/ktor/response/ApplicationSendPipeline.execute (Ljava/lang/Object;Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; DUP ALOAD 11 IF_ACMPNE L31 L32 LINENUMBER 294 L32 ALOAD 11 ASTORE 13 POP ALOAD 13 NOP GOTO L33 L27 ALOAD 9 GETFIELD UserControllerKt
1.label:IINVOKEVIRTUALio/ktor/response/ApplicationSendPipeline.execute(Ljava/lang/Object;Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;DUPALOAD11IFACMPNEL31L32LINENUMBER294L32ALOAD11ASTORE13POPALOAD13NOPGOTOL33L27ALOAD9GETFIELDUserControllerKtuserRoutes
1 : Ljava/lang/Object; ASTORE 7 ALOAD 9 GETFIELD UserControllerKt
1:Ljava/lang/Object;ASTORE7ALOAD9GETFIELDUserControllerKtuserRoutes
0 : Ljava/lang/Object; CHECKCAST io/ktor/application/ApplicationCall ASTORE 6 ALOAD 10 DUP INSTANCEOF kotlin/Result
0:Ljava/lang/Object;CHECKCASTio/ktor/application/ApplicationCallASTORE6ALOAD10DUPINSTANCEOFkotlin/ResultFailure
IFEQ L34
L34
ALOAD 10
L31
LINENUMBER 296 L31
GETSTATIC kotlin/Unit.INSTANCE : Lkotlin/Unit;
GOTO L33
L28
NEW java/lang/IllegalStateException
LDC “call to ‘resume’ before ‘invoke’ with coroutine”
INVOKESPECIAL java/lang/IllegalStateException. (Ljava/lang/String;)V
L33
L35
LINENUMBER 292 L35
ARETURN
L36
LOCALVARIABLE this_
156
iv Lorg/litote/kmongo/coroutine/CoroutineDatabase; L13 L15 6 LOCALVARIABLE collectionName
ivLorg/litote/kmongo/coroutine/CoroutineDatabase;L13L156LOCALVARIABLEcollectionNameiv Ljava/lang/String; L13 L15 7
LOCALVARIABLE
if$getCollection I L14 L15 8
receiver
receiveriv Lio/ktor/util/pipeline/PipelineContext; L18 L20 6
if$getCall I L19 L20 7
receiveriv Lio/ktor/application/ApplicationCall; L22 L33 6
LOCALVARIABLE message$iv Ljava/lang/Object; L22 L33 7
if$respond I L30 L28 12
continuation
continuationiv Lkotlin/coroutines/Continuation; L24 L28 9
LOCALVARIABLE user LUser; L4 L35 5
LOCALVARIABLE this LUserControllerKt$userRoutes$1$2; L0 L36 0
LOCALVARIABLE $receiver Lio/ktor/util/pipeline/PipelineContext; L0 L36 1
LOCALVARIABLE request LCreateUserRequest; L0 L36 2
LOCALVARIABLE continuation Lkotlin/coroutines/Continuation; L0 L36 3
ia
2post I L0 L36 3
MAXSTACK = 8
MAXLOCALS = 14
File being compiled at position: (33,9) in D:/temp/tests/ktor-kmongo-sample2/src/UserController.kt
The root cause was thrown at: MethodInliner.kt:817
File being compiled at position: file://D:/temp/tests/ktor-kmongo-sample2/src/UserController.kt
The root cause was thrown at: InlineCodegen.kt:124
at org.jetbrains.kotlin.codegen.CompilationErrorHandler.lambda$static
74
97
68
47
39
J
442
0(CompilationErrorHandler.java:24) at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:74) at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generatePackage(CodegenFactory.kt:97) at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generateModule(CodegenFactory.kt:68) at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.doGenerateFiles(KotlinCodegenFacade.java:47) at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:39) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:442) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules
0(CompilationErrorHandler.java:24)atorg.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:74)atorg.jetbrains.kotlin.codegen.DefaultCodegenFactory.generatePackage(CodegenFactory.kt:97)atorg.jetbrains.kotlin.codegen.DefaultCodegenFactory.generateModule(CodegenFactory.kt:68)atorg.jetbrains.kotlin.codegen.KotlinCodegenFacade.doGenerateFiles(KotlinCodegenFacade.java:47)atorg.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:39)atorg.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:442)atorg.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModulescli(KotlinToJVMBytecodeCompiler.kt:146)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:154)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:51)
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.daemon.CompileServiceImpl
compile
inlinedifAlive$lambda
399
1.invoke(CompileServiceImpl.kt:399) at org.jetbrains.kotlin.daemon.CompileServiceImpl
1.invoke(CompileServiceImpl.kt:399)atorg.jetbrains.kotlin.daemon.CompileServiceImplcompileKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲ifAlive$lambda$…inlined
ifAlive
ifAlivelambda
927
2.invoke(CompileServiceImpl.kt:927) at org.jetbrains.kotlin.daemon.CompileServiceImpl
2.invoke(CompileServiceImpl.kt:927)atorg.jetbrains.kotlin.daemon.CompileServiceImpldoCompileKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲ifAlive$lambda$…$this
1.client : Lkotlin/Lazy;
ASTORE 6
GETSTATIC UserControllerKt$userRoutes$1
1.dbName : Ljava/lang/String;
INVOKEVIRTUAL org/litote/kmongo/coroutine/CoroutineClient.getDatabase (Ljava/lang/String;)Lorg/litote/kmongo/coroutine/CoroutineDatabase;
L12
LINENUMBER 290 L12
2.KaTeX parse error: Can't use function '$' in math mode at position 5: this$̲0 : LUserContro…specialKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲postTyped$1$1$l…specialKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲postTyped$1$1$l…specialKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲postTyped$1$1$l…specialKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲postTyped$1$1$l…specialKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲postTyped$1$1$l…specialKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲postTyped$1$1$l…specialKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲postTyped$1$1$l…specialKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲postTyped$1$1$l…specialKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲postTyped$1$1$l…$this
2.KaTeX parse error: Can't use function '$' in math mode at position 5: this$̲0 : LUserContro…specialKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲postTyped$1$1$l…specialKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲postTyped$1$1$l…specialKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲postTyped$1$1$l…specialKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲postTyped$1$1$l…specialKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲postTyped$1$1$l…specialKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲postTyped$1$1$l…specialKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲postTyped$1$1$l…specialKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲postTyped$1$1$l…special$
Caused by: java.lang.RuntimeException: Trying to access skipped parameter: Ljava/lang/Object; at 0
at org.jetbrains.kotlin.codegen.inline.LocalVarRemapper.remap(LocalVarRemapper.kt:80)
at org.jetbrains.kotlin.codegen.inline.LocalVarRemapper.visitVarInsn(LocalVarRemapper.kt:103)
at org.jetbrains.kotlin.codegen.inline.RemapVisitor.visitVarInsn(RemapVisitor.java:53)
at org.jetbrains.org.objectweb.asm.tree.VarInsnNode.accept(VarInsnNode.java:86)
at org.jetbrains.org.objectweb.asm.tree.InsnList.accept(InsnList.java:162)
at org.jetbrains.org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:817)
at org.jetbrains.kotlin.codegen.inline.MethodInliner.doInline(MethodInliner.kt:111)
… 128 more