Kotlin / kotlinx.coroutines

Library support for Kotlin coroutines
Apache License 2.0
13.07k stars 1.85k forks source link

Wrong bytecode generated on 1.3.7 in Android Studio #2050

Closed personshelldon closed 4 years ago

personshelldon commented 4 years ago

Hello! After migrating to version 1.3.7 there is an error raised in this piece of code:

private fun getNfsDirFiles(
        uri: Uri,
        projection: Array<out String>?
    ): Cursor? {
        ...
        try {
            ...
            // this line producing error
            val directLink = runBlocking { nfsRepository.getDirectPath(path) }
            ...       
        } catch (e: IOException) {
            ...
        }
        return result
}

Stack trace:

org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: wrong bytecode generated
<no bytecode>
File being compiled: (130,5) in D:/Desktop/NFS/app/src/main/java/com/don11995/nfs/providers/nfs/NfsProvider.kt
The root cause org.jetbrains.kotlin.codegen.CompilationException was thrown at: org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:92)
    at org.jetbrains.kotlin.codegen.FunctionCodegen.endVisit(FunctionCodegen.java:936)
    at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethodBody(FunctionCodegen.java:493)
    at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:261)
    at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:177)
    at org.jetbrains.kotlin.codegen.FunctionCodegen.gen(FunctionCodegen.java:148)
    at org.jetbrains.kotlin.codegen.MemberCodegen.genSimpleMember(MemberCodegen.java:197)
    at org.jetbrains.kotlin.codegen.ClassBodyCodegen.generateDeclaration(ClassBodyCodegen.java:166)
    at org.jetbrains.kotlin.codegen.ClassBodyCodegen.generateBody(ClassBodyCodegen.java:86)
    at org.jetbrains.kotlin.codegen.MemberCodegen.generate(MemberCodegen.java:129)
    at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:302)
    at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:286)
    at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateClassesAndObjectsInFile(PackageCodegenImpl.java:115)
    at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateFile(PackageCodegenImpl.java:134)
    at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:70)
    at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generatePackage(CodegenFactory.kt:88)
    at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generateModule(CodegenFactory.kt:67)
    at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:35)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:634)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:194)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:163)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:51)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:85)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:43)
    at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:105)
    at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:349)
    at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:105)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:237)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:88)
    at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:606)
    at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:99)
    at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1645)
    at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
    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:357)
    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:573)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't transform method node:
getNfsDirFiles (Landroid/net/Uri;[Ljava/lang/String;)Landroid/database/Cursor;:
    // annotable parameter count: 2 (visible)
    // annotable parameter count: 2 (invisible)
    TRYCATCHBLOCK L0 L1 L2 java/lang/NumberFormatException
    TRYCATCHBLOCK L3 L4 L5 java/io/IOException
   L6
    LINENUMBER 134 L6
    NEW kotlin/jvm/internal/Ref$ObjectRef
    DUP
    INVOKESPECIAL kotlin/jvm/internal/Ref$ObjectRef.<init> ()V
    ASTORE 3
    ALOAD 3
    ALOAD 1
    GETSTATIC com/don11995/nfs/providers/nfs/NfsProvider.SELECTION_NFS_DIR : Ljava/lang/String;
    INVOKEVIRTUAL android/net/Uri.getQueryParameter (Ljava/lang/String;)Ljava/lang/String;
    DUP
    IFNULL L7
    GOTO L8
   L7
    LINENUMBER 134 L7
    POP
    LDC ""
   L8
    PUTFIELD kotlin/jvm/internal/Ref$ObjectRef.element : Ljava/lang/Object;
   L9
    LINENUMBER 135 L9
   L10
   L0
    NOP
   L11
    LINENUMBER 136 L11
    ALOAD 1
    GETSTATIC com/don11995/nfs/providers/nfs/NfsProvider.SELECTION_FLAG : Ljava/lang/String;
    INVOKEVIRTUAL android/net/Uri.getQueryParameter (Ljava/lang/String;)Ljava/lang/String;
    DUP
    IFNULL L12
    GOTO L13
   L12
    LINENUMBER 136 L12
    POP
    LDC "0"
   L13
    INVOKESTATIC java/lang/Integer.parseInt (Ljava/lang/String;)I
    ISTORE 5
   L14
    LINENUMBER 137 L14
    ILOAD 5
    ICONST_2
    IF_ICMPGT L15
    ILOAD 5
    ICONST_0
    IF_ICMPGE L16
   L15
    LINENUMBER 138 L15
    NEW java/lang/StringBuilder
    DUP
    INVOKESPECIAL java/lang/StringBuilder.<init> ()V
    LDC "Incorrect flag: "
    INVOKEVIRTUAL java/lang/StringBuilder.append (Ljava/lang/String;)Ljava/lang/StringBuilder;
    ILOAD 5
    INVOKEVIRTUAL java/lang/StringBuilder.append (I)Ljava/lang/StringBuilder;
    LDC "! Fallback to default"
    INVOKEVIRTUAL java/lang/StringBuilder.append (Ljava/lang/String;)Ljava/lang/StringBuilder;
    INVOKEVIRTUAL java/lang/StringBuilder.toString ()Ljava/lang/String;
    ICONST_0
    ANEWARRAY java/lang/Object
    INVOKESTATIC com/don11995/log/SimpleLog.e (Ljava/lang/String;[Ljava/lang/Object;)V
   L17
    LINENUMBER 139 L17
    ICONST_0
   L18
    GOTO L19
   L16
    LINENUMBER 141 L16
    ILOAD 5
   L20
    LINENUMBER 137 L20
   L19
    ISTORE 5
   L1
    GOTO L21
   L2
    LINENUMBER 143 L2
    ASTORE 6
   L22
    LINENUMBER 144 L22
    ICONST_0
   L23
    ISTORE 5
   L24
    LINENUMBER 135 L24
   L21
    ILOAD 5
    ISTORE 4
   L25
    LINENUMBER 147 L25
    ALOAD 3
    GETFIELD kotlin/jvm/internal/Ref$ObjectRef.element : Ljava/lang/Object;
    CHECKCAST java/lang/String
    CHECKCAST java/lang/CharSequence
    ASTORE 5
    NOP
   L26
    ICONST_0
    ISTORE 6
   L27
    ALOAD 5
    INVOKEINTERFACE java/lang/CharSequence.length ()I (itf)
    IFNE L28
    ICONST_1
    GOTO L29
   L28
    ICONST_0
   L29
    NOP
    GOTO L30
   L30
    IFEQ L31
   L32
    LINENUMBER 148 L32
    LDC "nfsDirPath is empty after parse!"
    ICONST_0
    ANEWARRAY java/lang/Object
    INVOKESTATIC com/don11995/log/SimpleLog.e (Ljava/lang/String;[Ljava/lang/Object;)V
   L33
    LINENUMBER 149 L33
    ACONST_NULL
    ARETURN
   L31
    LINENUMBER 152 L31
    ALOAD 0
    ALOAD 2
    GETSTATIC com/don11995/nfs/providers/nfs/NfsProvider.COLUMNS_NFS_DIR_FILES : Ljava/util/ArrayList;
    CHECKCAST java/util/List
    INVOKESPECIAL com/don11995/nfs/providers/nfs/NfsProvider.calculateProjection ([Ljava/lang/String;Ljava/util/List;)[Ljava/lang/String;
    ASTORE 5
   L34
    LINENUMBER 153 L34
    ALOAD 5
    ASTORE 6
    NOP
   L35
    ICONST_0
    ISTORE 7
   L36
    ICONST_0
    ISTORE 8
   L37
    ALOAD 6
    IFNULL L38
    ALOAD 6
    ASTORE 8
    ICONST_0
    ISTORE 9
    ALOAD 8
    ARRAYLENGTH
    IFNE L39
    ICONST_1
    GOTO L40
   L39
    ICONST_0
   L40
    IFEQ L41
   L38
    ICONST_1
    GOTO L42
   L41
    ICONST_0
   L42
    NOP
    GOTO L43
   L43
    IFEQ L44
   L45
    LINENUMBER 154 L45
    LDC "Computed projection is empty!"
    ICONST_0
    ANEWARRAY java/lang/Object
    INVOKESTATIC com/don11995/log/SimpleLog.e (Ljava/lang/String;[Ljava/lang/Object;)V
   L46
    LINENUMBER 155 L46
    ACONST_NULL
    ARETURN
   L44
    LINENUMBER 158 L44
   L47
   L3
    NOP
   L48
    LINENUMBER 159 L48
    ACONST_NULL
    NEW com/don11995/nfs/providers/nfs/NfsProvider$getNfsDirFiles$nfsFiles$1
    DUP
    ALOAD 0
    ALOAD 3
    ACONST_NULL
    INVOKESPECIAL com/don11995/nfs/providers/nfs/NfsProvider$getNfsDirFiles$nfsFiles$1.<init> (Lcom/don11995/nfs/providers/nfs/NfsProvider;Lkotlin/jvm/internal/Ref$ObjectRef;Lkotlin/coroutines/Continuation;)V
    CHECKCAST kotlin/jvm/functions/Function2
    ICONST_1
    ACONST_NULL
    INVOKESTATIC kotlinx/coroutines/BuildersKt.runBlocking$default (Lkotlin/coroutines/CoroutineContext;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Ljava/lang/Object;
    CHECKCAST java/util/List
    ASTORE 6
   L49
    LINENUMBER 161 L49
    ALOAD 0
    INVOKESPECIAL com/don11995/nfs/providers/nfs/NfsProvider.getSettingsRepository ()Lcom/don11995/nfs/repository/settings/SettingsRepository;
    INVOKEINTERFACE com/don11995/nfs/repository/settings/SettingsRepository.getSortType ()Lio/reactivex/Flowable; (itf)
    INVOKEVIRTUAL io/reactivex/Flowable.blockingFirst ()Ljava/lang/Object;
    DUP
    LDC "settingsRepository.getSortType().blockingFirst()"
    INVOKESTATIC kotlin/jvm/internal/Intrinsics.checkExpressionValueIsNotNull (Ljava/lang/Object;Ljava/lang/String;)V
    CHECKCAST com/don11995/nfs/datastores/settings/SettingsDataStore$SortType
    INVOKESTATIC com/don11995/nfs/datastores/settings/ExtKt.getComparator (Lcom/don11995/nfs/datastores/settings/SettingsDataStore$SortType;)Ljava/util/Comparator;
    ASTORE 7
   L50
    LINENUMBER 162 L50
    ALOAD 6
    ALOAD 7
    INVOKESTATIC java/util/Collections.sort (Ljava/util/List;Ljava/util/Comparator;)V
   L51
    LINENUMBER 164 L51
    NEW android/database/MatrixCursor
    DUP
    ALOAD 5
    INVOKESPECIAL android/database/MatrixCursor.<init> ([Ljava/lang/String;)V
    ASTORE 8
   L52
    LINENUMBER 166 L52
    ALOAD 6
    INVOKEINTERFACE java/util/List.iterator ()Ljava/util/Iterator; (itf)
    ASTORE 10
   L53
    ALOAD 10
    INVOKEINTERFACE java/util/Iterator.hasNext ()Z (itf)
    IFEQ L54
    ALOAD 10
    INVOKEINTERFACE java/util/Iterator.next ()Ljava/lang/Object; (itf)
    CHECKCAST com/don11995/nfs/api/entry/FsEntry
    ASTORE 9
   L55
    ALOAD 9
    INVOKEVIRTUAL com/don11995/nfs/api/entry/FsEntry.component1 ()Lcom/don11995/nfs/api/entry/FsEntryTitle;
    ASTORE 11
    ALOAD 12
    ALOAD 9
    INVOKEVIRTUAL com/don11995/nfs/api/entry/FsEntry.component2 ()Ljava/lang/String;
    PUTFIELD kotlin/jvm/internal/Ref$ObjectRef.element : Ljava/lang/Object;
    ALOAD 9
    INVOKEVIRTUAL com/don11995/nfs/api/entry/FsEntry.component5 ()Z
    ISTORE 13
   L56
    LINENUMBER 167 L56
    ILOAD 13
    IFEQ L57
   L58
    LINENUMBER 168 L58
    ILOAD 4
    IFEQ L59
    ILOAD 4
    ICONST_1
    IF_ICMPEQ L59
   L60
    GOTO L61
   L59
    LINENUMBER 169 L59
    NEW com/don11995/nfs/providers/nfs/model/FillCursor
    DUP
   L62
    LINENUMBER 170 L62
    ALOAD 8
   L63
    LINENUMBER 171 L63
    ALOAD 5
   L64
    LINENUMBER 172 L64
    ALOAD 11
    ACONST_NULL
    ICONST_1
    ACONST_NULL
    INVOKESTATIC com/don11995/nfs/utils/ResourcesKt.toText$default (Lcom/don11995/nfs/api/entry/FsEntryTitle;Landroid/content/Context;ILjava/lang/Object;)Ljava/lang/String;
   L65
    LINENUMBER 173 L65
    ALOAD 12
    GETFIELD kotlin/jvm/internal/Ref$ObjectRef.element : Ljava/lang/Object;
    CHECKCAST java/lang/String
   L66
    LINENUMBER 174 L66
    ICONST_1
   L67
    LINENUMBER 175 L67
    LDC ""
   L68
    LINENUMBER 169 L68
    INVOKESPECIAL com/don11995/nfs/providers/nfs/model/FillCursor.<init> (Landroid/database/MatrixCursor;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/String;)V
    ASTORE 14
   L69
    LINENUMBER 177 L69
    ALOAD 0
    ALOAD 14
    INVOKESPECIAL com/don11995/nfs/providers/nfs/NfsProvider.fillGetNfsDirFilesCursor (Lcom/don11995/nfs/providers/nfs/model/FillCursor;)V
   L70
    GOTO L61
   L57
    LINENUMBER 179 L57
    ILOAD 4
    IFEQ L71
    ILOAD 4
    ICONST_2
    IF_ICMPEQ L71
   L72
    GOTO L61
   L71
    LINENUMBER 180 L71
    ACONST_NULL
    NEW com/don11995/nfs/providers/nfs/NfsProvider$getNfsDirFiles$directLink$1
    DUP
    ALOAD 0
    ALOAD 12
    ACONST_NULL
    INVOKESPECIAL com/don11995/nfs/providers/nfs/NfsProvider$getNfsDirFiles$directLink$1.<init> (Lcom/don11995/nfs/providers/nfs/NfsProvider;Lkotlin/jvm/internal/Ref$ObjectRef;Lkotlin/coroutines/Continuation;)V
    CHECKCAST kotlin/jvm/functions/Function2
    ICONST_1
    ACONST_NULL
    INVOKESTATIC kotlinx/coroutines/BuildersKt.runBlocking$default (Lkotlin/coroutines/CoroutineContext;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Ljava/lang/Object;
    CHECKCAST java/lang/String
    ASTORE 14
   L73
    LINENUMBER 181 L73
    NEW com/don11995/nfs/providers/nfs/model/FillCursor
    DUP
   L74
    LINENUMBER 182 L74
    ALOAD 8
   L75
    LINENUMBER 183 L75
    ALOAD 5
   L76
    LINENUMBER 184 L76
    ALOAD 11
    ACONST_NULL
    ICONST_1
    ACONST_NULL
    INVOKESTATIC com/don11995/nfs/utils/ResourcesKt.toText$default (Lcom/don11995/nfs/api/entry/FsEntryTitle;Landroid/content/Context;ILjava/lang/Object;)Ljava/lang/String;
   L77
    LINENUMBER 185 L77
    ALOAD 12
    GETFIELD kotlin/jvm/internal/Ref$ObjectRef.element : Ljava/lang/Object;
    CHECKCAST java/lang/String
   L78
    LINENUMBER 186 L78
    ICONST_0
   L79
    LINENUMBER 187 L79
    ALOAD 14
   L80
    LINENUMBER 181 L80
    INVOKESPECIAL com/don11995/nfs/providers/nfs/model/FillCursor.<init> (Landroid/database/MatrixCursor;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/String;)V
    ASTORE 15
   L81
    LINENUMBER 189 L81
    ALOAD 0
    ALOAD 15
    INVOKESPECIAL com/don11995/nfs/providers/nfs/NfsProvider.fillGetNfsDirFilesCursor (Lcom/don11995/nfs/providers/nfs/model/FillCursor;)V
   L82
    LINENUMBER 190 L82
   L61
    LINENUMBER 166 L61
   L83
    GOTO L53
   L54
    LINENUMBER 192 L54
    ALOAD 8
    CHECKCAST android/database/Cursor
    ARETURN
   L4
    GOTO L84
   L5
    LINENUMBER 193 L5
    ASTORE 6
   L85
    LINENUMBER 194 L85
    ALOAD 6
    INVOKESTATIC com/don11995/log/SimpleLog.e (Ljava/lang/Object;)V
   L86
    LINENUMBER 195 L86
    ACONST_NULL
    ARETURN
   L87
    LINENUMBER 196 L87
   L84
    LINENUMBER 197 L84
    ACONST_NULL
    ARETURN
   L88
    LOCALVARIABLE innerFlag I L14 L19 5
    LOCALVARIABLE e Ljava/lang/NumberFormatException; L22 L24 6
    LOCALVARIABLE fillCursor Lcom/don11995/nfs/providers/nfs/model/FillCursor; L69 L70 14
    LOCALVARIABLE fillCursor Lcom/don11995/nfs/providers/nfs/model/FillCursor; L81 L82 15
    LOCALVARIABLE directLink Ljava/lang/String; L73 L82 14
    LOCALVARIABLE isBrowsable Z L56 L83 13
    LOCALVARIABLE path Ljava/lang/String; L56 L83 12
    LOCALVARIABLE name Lcom/don11995/nfs/api/entry/FsEntryTitle; L56 L83 11
    LOCALVARIABLE result Landroid/database/MatrixCursor; L52 L4 8
    LOCALVARIABLE comparator Ljava/util/Comparator; L50 L4 7
    LOCALVARIABLE nfsFiles Ljava/util/List; L49 L4 6
    LOCALVARIABLE e Ljava/io/IOException; L85 L87 6
    LOCALVARIABLE cols [Ljava/lang/String; L34 L88 5
    LOCALVARIABLE flag I L25 L88 4
    LOCALVARIABLE nfsDirPath Lkotlin/jvm/internal/Ref$ObjectRef; L9 L88 3
    LOCALVARIABLE this Lcom/don11995/nfs/providers/nfs/NfsProvider; L6 L88 0
    LOCALVARIABLE uri Landroid/net/Uri; L6 L88 1
    LOCALVARIABLE projection [Ljava/lang/String; L6 L88 2
    MAXSTACK = 8
    MAXLOCALS = 16

File is unknown
The root cause java.lang.AssertionError was thrown at: org.jetbrains.kotlin.codegen.optimization.MethodVerifier.transform(MethodVerifier.kt:28)
    at org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:92)
    at org.jetbrains.org.objectweb.asm.MethodVisitor.visitEnd(MethodVisitor.java:778)
    at org.jetbrains.kotlin.codegen.FunctionCodegen.endVisit(FunctionCodegen.java:929)
    ... 46 more
Caused by: java.lang.AssertionError: AFTER mandatory stack transformations: incorrect bytecode
    at org.jetbrains.kotlin.codegen.optimization.MethodVerifier.transform(MethodVerifier.kt:28)
    at org.jetbrains.kotlin.codegen.optimization.transformer.CompositeMethodTransformer.transform(CompositeMethodTransformer.kt:25)
    at org.jetbrains.kotlin.codegen.optimization.OptimizationMethodVisitor.performTransformations(OptimizationMethodVisitor.kt:62)
    at org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:70)
    ... 48 more
Caused by: java.lang.RuntimeException: org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException: Error at instruction 239: Expected an object reference, but found .
    at org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer.runAnalyzer(MethodTransformer.java:34)
    at org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer.analyze(MethodTransformer.java:44)
    at org.jetbrains.kotlin.codegen.optimization.MethodVerifier.transform(MethodVerifier.kt:26)
    ... 51 more
Caused by: org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException: Error at instruction 239: Expected an object reference, but found .
    at org.jetbrains.org.objectweb.asm.tree.analysis.Analyzer.analyze(Analyzer.java:291)
    at org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer.runAnalyzer(MethodTransformer.java:31)
    ... 53 more
Caused by: org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException: Expected an object reference, but found .
    at org.jetbrains.org.objectweb.asm.tree.analysis.BasicVerifier.copyOperation(BasicVerifier.java:90)
    at org.jetbrains.org.objectweb.asm.tree.analysis.BasicVerifier.copyOperation(BasicVerifier.java:43)
    at org.jetbrains.org.objectweb.asm.tree.analysis.Frame.execute(Frame.java:288)
    at org.jetbrains.org.objectweb.asm.tree.analysis.Analyzer.analyze(Analyzer.java:187)
    ... 54 more

FAILURE: Build failed with an exception.

Solution that works for me is to move runBlocking call into separate function and call that function or to downgrade to version 1.3.6. But, I think, this is really a bug, because it can be reproduced only on version 1.3.7.

Environment:

linuxct commented 4 years ago

+1 to this, just faced the issue while upgrading from 1.3.5 to 1.3.7.

pwgraham91 commented 4 years ago

1.3.6 works fine for me. I get the error on 1.3.7

danielebart commented 4 years ago

+1. From 1.3.5 to 1.3.7, same issue

Mygod commented 4 years ago

A reproducible sample: https://github.com/shadowsocks/shadowsocks-android/commit/01e1819f037d426fa1b38ea35a1732e4393885c7

https://app.circleci.com/pipelines/github/shadowsocks/shadowsocks-android/81/workflows/0d1b92a7-2a0c-4ee6-96b2-de6e84be3fe3/jobs/597/steps

qwwdfsad commented 4 years ago

Unfortunately, this is a bug in Kotlin compiler related to function with contracts that were added in #2030.

We are working on the fix, a workaround is to extract withContext calls from catch blocks (I'll try to post more specific workaround later) to separate functions.

Also, it is fixed in 1.4-M2 compiler: https://youtrack.jetbrains.com/issue/KT-39298

pwgraham91 commented 4 years ago

This still is an issue in 1.3.8

Mygod commented 4 years ago

They said it is a compiler bug, not a bug in this library.

qwwdfsad commented 4 years ago

Fixed in 1.3.9 with Kotlin 1.4

hellosagar commented 3 years ago
> Task :app:compileDebugKotlin
e: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: wrong bytecode generated
  @Lorg/jetbrains/annotations/Nullable;() // invisible
    // annotable parameter count: 1 (visible)
    // annotable parameter count: 1 (invisible)
    @Lorg/jetbrains/annotations/NotNull;() // invisible, parameter 0
   L0
   L1
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.p$ : Lkotlinx/coroutines/CoroutineScope;
    ASTORE 2
   L2
   L3
    LINENUMBER 820 L3
    ICONST_0
    ISTORE 3
    BIPUSH 100
    ISTORE 4
   L4
    ILOAD 3
    ILOAD 4
    IF_ICMPGT L5
   L6
   L7
    LINENUMBER 821 L7
    LDC 10
    ALOAD 0
    ALOAD 0
    ALOAD 2
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.L$0 : Ljava/lang/Object;
    ALOAD 0
    ILOAD 3
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$0 : I
    ALOAD 0
    ILOAD 4
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$1 : I
    ALOAD 0
    ICONST_1
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.label : I
    INVOKESTATIC kotlinx/coroutines/DelayKt.delay (JLkotlin/coroutines/Continuation;)Ljava/lang/Object;
   L8
    DUP
    ALOAD 5
    IF_ACMPNE L9
   L10
    LINENUMBER 819 L10
    ALOAD 5
    ARETURN
   L11
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$1 : I
    ISTORE 4
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$0 : I
    ISTORE 3
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.L$0 : Ljava/lang/Object;
    CHECKCAST kotlinx/coroutines/CoroutineScope
    ASTORE 2
   L12
    NOP
    ALOAD 1
    INVOKESTATIC kotlin/ResultKt.throwOnFailure (Ljava/lang/Object;)V
    ALOAD 1
   L9
    LINENUMBER 822 L9
    POP
e: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: wrong bytecode generated

    NOP
   L13
    INVOKESTATIC kotlinx/coroutines/Dispatchers.getMain ()Lkotlinx/coroutines/MainCoroutineDispatcher;
    CHECKCAST kotlin/coroutines/CoroutineContext
    NEW com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1$1
    DUP
    ALOAD 0
    ALOAD 3
    ACONST_NULL
    INVOKESPECIAL com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1$1.<init> (Lcom/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1;Lkotlin/jvm/internal/Ref$IntRef;Lkotlin/coroutines/Continuation;)V
    CHECKCAST kotlin/jvm/functions/Function2
    ALOAD 0
    ALOAD 0
    ALOAD 2
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.L$0 : Ljava/lang/Object;
    ALOAD 0
    ILOAD 3
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$0 : I
    ALOAD 0
    ILOAD 4
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$1 : I
    ALOAD 0
    ICONST_2
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.label : I
    INVOKESTATIC kotlinx/coroutines/BuildersKt.withContext (Lkotlin/coroutines/CoroutineContext;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
   L14
    DUP
    ALOAD 5
    IF_ACMPNE L15
   L16
    LINENUMBER 819 L16
    ALOAD 5
    ARETURN
   L17
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$1 : I
    ISTORE 4
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$0 : I
    ISTORE 3
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.L$0 : Ljava/lang/Object;
    CHECKCAST kotlinx/coroutines/CoroutineScope
    ASTORE 2
   L18
    NOP
    ALOAD 1
    INVOKESTATIC kotlin/ResultKt.throwOnFailure (Ljava/lang/Object;)V
    ALOAD 1
   L15
    LINENUMBER 820 L15
    POP
    NOP
   L19
   L20
   L21
    IINC 3 1
   L22
    GOTO L4
   L5
   L23
   L24
    LINENUMBER 826 L24
    GETSTATIC kotlin/Unit.INSTANCE : Lkotlin/Unit;
    ARETURN
   L25
   L26
   L27
    NEW java/lang/IllegalStateException
    DUP
    LDC "call to 'resume' before 'invoke' with coroutine"
    INVOKESPECIAL java/lang/IllegalStateException.<init> (Ljava/lang/String;)V
    ATHROW
    RETURN
   L28
    LOCALVARIABLE $this$launch Lkotlinx/coroutines/CoroutineScope; L2 L26 2
    LOCALVARIABLE i I L6 L22 3
    LOCALVARIABLE this Lcom/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1; L0 L25 0
    LOCALVARIABLE $result Ljava/lang/Object; L0 L25 1
    MAXSTACK = 6
    MAXLOCALS = 5

File being compiled: (819,51) in /home/sagar/Aspire/Aspire-Android/app/src/main/java/com/letsaspire/android/payment/application/view/PaymentFragment.kt
The root cause org.jetbrains.kotlin.codegen.CompilationException was thrown at: org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:92)
    at org.jetbrains.kotlin.codegen.FunctionCodegen.endVisit(FunctionCodegen.java:936)
    at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethodBody(FunctionCodegen.java:493)
    at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:261)
    at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:177)
    at org.jetbrains.kotlin.codegen.coroutines.CoroutineCodegenForLambda.generateResumeImpl(CoroutineCodegen.kt:464)
    at org.jetbrains.kotlin.codegen.coroutines.CoroutineCodegenForLambda.generateClosureBody(CoroutineCodegen.kt:239)
    at org.jetbrains.kotlin.codegen.ClosureCodegen.generateBody(ClosureCodegen.java:169)
    at org.jetbrains.kotlin.codegen.coroutines.CoroutineCodegenForLambda.generateBody(CoroutineCodegen.kt:247)
    at org.jetbrains.kotlin.codegen.MemberCodegen.generate(MemberCodegen.java:129)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.genClosure(ExpressionCodegen.java:1038)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.genClosure(ExpressionCodegen.java:1008)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.visitLambdaExpression(ExpressionCodegen.java:999)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.visitLambdaExpression(ExpressionCodegen.java:112)
    at org.jetbrains.kotlin.psi.KtLambdaExpression.accept(KtLambdaExpression.java:40)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:304)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:286)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:358)
    at org.jetbrains.kotlin.codegen.CallGenerator$DefaultCallGenerator.genValueAndPut(CallGenerator.kt:70)
    at org.jetbrains.kotlin.codegen.CallBasedArgumentGenerator.generateExpression(CallBasedArgumentGenerator.kt:42)
    at org.jetbrains.kotlin.codegen.ArgumentGenerator.generate(ArgumentGenerator.kt:68)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.invokeMethodWithArguments(ExpressionCodegen.java:2534)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.invokeMethodWithArguments(ExpressionCodegen.java:2506)
    at org.jetbrains.kotlin.codegen.Callable$invokeMethodWithArguments$1.invoke(Callable.kt:41)
    at org.jetbrains.kotlin.codegen.Callable$invokeMethodWithArguments$1.invoke(Callable.kt:13)
    at org.jetbrains.kotlin.codegen.OperationStackValue.putSelector(StackValue.kt:79)
    at org.jetbrains.kotlin.codegen.StackValue.put(StackValue.java:122)
    at org.jetbrains.kotlin.codegen.StackValue.put(StackValue.java:115)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.generateBlock(ExpressionCodegen.java:1282)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.generateBlock(ExpressionCodegen.java:1223)
    at org.jetbrains.kotlin.codegen.CodegenStatementVisitor.visitBlockExpression(CodegenStatementVisitor.java:56)
    at org.jetbrains.kotlin.codegen.CodegenStatementVisitor.visitBlockExpression(CodegenStatementVisitor.java:22)
    at org.jetbrains.kotlin.psi.KtBlockExpression.accept(KtBlockExpression.java:78)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:304)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.genStatement(ExpressionCodegen.java:409)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:366)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.lambda$generateIfExpression$0(ExpressionCodegen.java:538)
    at org.jetbrains.kotlin.codegen.OperationStackValue.putSelector(StackValue.kt:79)
    at org.jetbrains.kotlin.codegen.StackValueWithLeaveTask.putSelector(StackValue.kt:67)
    at org.jetbrains.kotlin.codegen.StackValue.put(StackValue.java:122)
    at org.jetbrains.kotlin.codegen.StackValue.put(StackValue.java:115)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.putStackValue(ExpressionCodegen.java:386)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:367)
    at org.jetbrains.kotlin.codegen.ExpressionCodegen.returnExpression(ExpressionCodegen.java:1731)
    at org.jetbrains.kotlin.codegen.FunctionGenerationStrategy$FunctionDefault.doGenerateBody(FunctionGenerationStrategy.java:64)
    at org.jetbrains.kotlin.codegen.FunctionGenerationStrategy$CodegenBased.generateBody(FunctionGenerationStrategy.java:84)
    at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethodBody(FunctionCodegen.java:654)
    at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethodBody(FunctionCodegen.java:479)
    at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:261)
    at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:177)
    at org.jetbrains.kotlin.codegen.FunctionCodegen.gen(FunctionCodegen.java:148)
    at org.jetbrains.kotlin.codegen.MemberCodegen.genSimpleMember(MemberCodegen.java:197)
    at org.jetbrains.kotlin.codegen.ClassBodyCodegen.generateDeclaration(ClassBodyCodegen.java:166)
    at org.jetbrains.kotlin.codegen.ClassBodyCodegen.generateBody(ClassBodyCodegen.java:86)
    at org.jetbrains.kotlin.codegen.MemberCodegen.generate(MemberCodegen.java:129)
    at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:302)
    at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:286)
    at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateClassesAndObjectsInFile(PackageCodegenImpl.java:115)
    at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateFile(PackageCodegenImpl.java:134)
    at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:70)
    at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generatePackage(CodegenFactory.kt:88)
    at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generateModule(CodegenFactory.kt:67)
    at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:35)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:634)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:194)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:163)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:51)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:85)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:43)
    at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:105)
    at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:349)
    at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:105)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:237)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.access$compileIncrementally(IncrementalCompilerRunner.kt:37)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner$compile$2.invoke(IncrementalCompilerRunner.kt:79)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:91)
    at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:606)
    at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:99)
    at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1645)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
    at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
    at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't transform method node:
invokeSuspend (Ljava/lang/Object;)Ljava/lang/Object;:
  @Lorg/jetbrains/annotations/Nullable;() // invisible
    // annotable parameter count: 1 (visible)
    // annotable parameter count: 1 (invisible)
    @Lorg/jetbrains/annotations/NotNull;() // invisible, parameter 0
   L0
   L1
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.p$ : Lkotlinx/coroutines/CoroutineScope;
    ASTORE 2
   L2
   L3
    LINENUMBER 820 L3
    ICONST_0
    ISTORE 3
    BIPUSH 100
    ISTORE 4
   L4
    ILOAD 3
    ILOAD 4
    IF_ICMPGT L5
   L6
   L7
    LINENUMBER 821 L7
    LDC 10
    ALOAD 0
    ALOAD 0
    ALOAD 2
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.L$0 : Ljava/lang/Object;
    ALOAD 0
    ILOAD 3
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$0 : I
    ALOAD 0
    ILOAD 4
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$1 : I
    ALOAD 0
Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't transform method node:

    ICONST_1
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.label : I
    INVOKESTATIC kotlinx/coroutines/DelayKt.delay (JLkotlin/coroutines/Continuation;)Ljava/lang/Object;
   L8
    DUP
    ALOAD 5
    IF_ACMPNE L9
   L10
    LINENUMBER 819 L10
    ALOAD 5
    ARETURN
   L11
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$1 : I
    ISTORE 4
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$0 : I
    ISTORE 3
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.L$0 : Ljava/lang/Object;
    CHECKCAST kotlinx/coroutines/CoroutineScope
    ASTORE 2
   L12
    NOP
    ALOAD 1
    INVOKESTATIC kotlin/ResultKt.throwOnFailure (Ljava/lang/Object;)V
    ALOAD 1
   L9
    LINENUMBER 822 L9
    POP
    NOP
   L13
    INVOKESTATIC kotlinx/coroutines/Dispatchers.getMain ()Lkotlinx/coroutines/MainCoroutineDispatcher;
    CHECKCAST kotlin/coroutines/CoroutineContext
    NEW com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1$1
    DUP
    ALOAD 0
    ALOAD 3
    ACONST_NULL
    INVOKESPECIAL com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1$1.<init> (Lcom/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1;Lkotlin/jvm/internal/Ref$IntRef;Lkotlin/coroutines/Continuation;)V
    CHECKCAST kotlin/jvm/functions/Function2
    ALOAD 0
    ALOAD 0
    ALOAD 2
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.L$0 : Ljava/lang/Object;
    ALOAD 0
    ILOAD 3
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$0 : I
    ALOAD 0
    ILOAD 4
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$1 : I
    ALOAD 0
    ICONST_2
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.label : I
    INVOKESTATIC kotlinx/coroutines/BuildersKt.withContext (Lkotlin/coroutines/CoroutineContext;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
   L14
    DUP
    ALOAD 5
    IF_ACMPNE L15
   L16
    LINENUMBER 819 L16
    ALOAD 5
    ARETURN
   L17
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$1 : I
    ISTORE 4
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$0 : I
    ISTORE 3
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.L$0 : Ljava/lang/Object;
    CHECKCAST kotlinx/coroutines/CoroutineScope
    ASTORE 2
   L18
    NOP
    ALOAD 1
    INVOKESTATIC kotlin/ResultKt.throwOnFailure (Ljava/lang/Object;)V
    ALOAD 1
   L15
    LINENUMBER 820 L15
    POP
    NOP
   L19
   L20
   L21
    IINC 3 1
   L22
    GOTO L4
   L5
   L23
   L24
    LINENUMBER 826 L24
    GETSTATIC kotlin/Unit.INSTANCE : Lkotlin/Unit;
    ARETURN
   L25
   L26
   L27
    NEW java/lang/IllegalStateException
    DUP
    LDC "call to 'resume' before 'invoke' with coroutine"
    INVOKESPECIAL java/lang/IllegalStateException.<init> (Ljava/lang/String;)V
    ATHROW
    RETURN
   L28
    LOCALVARIABLE $this$launch Lkotlinx/coroutines/CoroutineScope; L2 L26 2
    LOCALVARIABLE i I L6 L22 3
    LOCALVARIABLE this Lcom/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1; L0 L25 0
    LOCALVARIABLE $result Ljava/lang/Object; L0 L25 1
    MAXSTACK = 6
    MAXLOCALS = 5

File is unknown
The root cause org.jetbrains.kotlin.codegen.CompilationException was thrown at: org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:92)
    at org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:92)
    at org.jetbrains.kotlin.codegen.FunctionCodegen.endVisit(FunctionCodegen.java:929)
    ... 94 more
Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't transform method node:
invokeSuspend (Ljava/lang/Object;)Ljava/lang/Object;:
  @Lorg/jetbrains/annotations/Nullable;() // invisible
    // annotable parameter count: 1 (visible)
    // annotable parameter count: 1 (invisible)
    @Lorg/jetbrains/annotations/NotNull;() // invisible, parameter 0
   L0
    INVOKESTATIC kotlin/coroutines/intrinsics/IntrinsicsKt.getCOROUTINE_SUSPENDED ()Ljava/lang/Object;
   L1
    LINENUMBER 819 L1
    ASTORE 5
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.label : I
    TABLESWITCH
      0: L2
      1: L3
      2: L4
      default: L5
   L2
    ALOAD 1
    INVOKESTATIC kotlin/ResultKt.throwOnFailure (Ljava/lang/Object;)V
   L6
   L7
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.p$ : Lkotlinx/coroutines/CoroutineScope;
    ASTORE 2
   L8
   L9
    LINENUMBER 820 L9
    ICONST_0
    ISTORE 3
    BIPUSH 100
    ISTORE 4
   L10
    ILOAD 3
    ILOAD 4
    IF_ICMPGT L11
   L12
   L13
    LINENUMBER 821 L13
    LDC 10
    ALOAD 0
    ALOAD 0
    ALOAD 2
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.L$0 : Ljava/lang/Object;
    ALOAD 0
    ILOAD 3
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$0 : I
    ALOAD 0
    ILOAD 4
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$1 : I
    ALOAD 0
    ICONST_1
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.label : I
    INVOKESTATIC kotlinx/coroutines/DelayKt.delay (JLkotlin/coroutines/Continuation;)Ljava/lang/Object;
   L14
    DUP
    ALOAD 5
    IF_ACMPNE L15
   L16
    LINENUMBER 819 L16
    ALOAD 5
    ARETURN
   L17
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$1 : I
    ISTORE 4
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$0 : I
    ISTORE 3
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.L$0 : Ljava/lang/Object;
    CHECKCAST kotlinx/coroutines/CoroutineScope
    ASTORE 2
   L18
    NOP
    ALOAD 1
    INVOKESTATIC kotlin/ResultKt.throwOnFailure (Ljava/lang/Object;)V
    ALOAD 1
   L15
    LINENUMBER 822 L15
    POP
    NOP
   L19
    INVOKESTATIC kotlinx/coroutines/Dispatchers.getMain ()Lkotlinx/coroutines/MainCoroutineDispatcher;
    CHECKCAST kotlin/coroutines/CoroutineContext
    NEW com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1$1
    DUP
    ALOAD 0
    ALOAD 3
    ACONST_NULL
    INVOKESPECIAL com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1$1.<init> (Lcom/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1;Lkotlin/jvm/internal/Ref$IntRef;Lkotlin/coroutines/Continuation;)V
    CHECKCAST kotlin/jvm/functions/Function2
    ALOAD 0
    ALOAD 0
    ALOAD 2
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.L$0 : Ljava/lang/Object;
    ALOAD 0
    ILOAD 3
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$0 : I
    ALOAD 0
    ILOAD 4
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$1 : I
    ALOAD 0
    ICONST_2
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.label : I
    INVOKESTATIC kotlinx/coroutines/BuildersKt.withContext (Lkotlin/coroutines/CoroutineContext;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
   L20
    DUP
    ALOAD 5
    IF_ACMPNE L21
   L22
    LINENUMBER 819 L22
    ALOAD 5
    ARETURN
   L23
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$1 : I
    ISTORE 4
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$0 : I
    ISTORE 3
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.L$0 : Ljava/lang/Object;
    CHECKCAST kotlinx/coroutines/CoroutineScope
    ASTORE 2
   L24
    NOP
    ALOAD 1
    INVOKESTATIC kotlin/ResultKt.throwOnFailure (Ljava/lang/Object;)V
    ALOAD 1
   L21
    LINENUMBER 820 L21
    POP
    NOP
   L25
   L26
   L27
    IINC 3 1
   L28
    GOTO L10
   L11
   L29
   L30
    LINENUMBER 826 L30
    GETSTATIC kotlin/Unit.INSTANCE : Lkotlin/Unit;
    ARETURN
   L31
   L32
   L5
    NEW java/lang/IllegalStateException
    DUP
    LDC "call to 'resume' before 'invoke' with coroutine"
    INVOKESPECIAL java/lang/IllegalStateException.<init> (Ljava/lang/String;)V
    ATHROW
    RETURN
   L33
    LOCALVARIABLE $this$launch Lkotlinx/coroutines/CoroutineScope; L8 L32 2
    LOCALVARIABLE i I L12 L28 3
    LOCALVARIABLE this Lcom/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1; L0 L33 0
    LOCALVARIABLE $result Ljava/lang/Object; L0 L33 1
    MAXSTACK = 6
    MAXLOCALS = 6

File is unknown
The root cause org.jetbrains.kotlin.codegen.CompilationException was thrown at: org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:92)
    at org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:92)
    at org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:90)
    ... 95 more
Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't transform method node:
invokeSuspend (Ljava/lang/Object;)Ljava/lang/Object;:
  @Lorg/jetbrains/annotations/Nullable;() // invisible
    // annotable parameter count: 1 (visible)
    // annotable parameter count: 1 (invisible)
    @Lorg/jetbrains/annotations/NotNull;() // invisible, parameter 0
   L0
    INVOKESTATIC kotlin/coroutines/intrinsics/IntrinsicsKt.getCOROUTINE_SUSPENDED ()Ljava/lang/Object;
   L1
    LINENUMBER 819 L1
    ASTORE 5
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.label : I
    TABLESWITCH
      0: L2
      1: L3
      2: L4
      default: L5
   L2
    ALOAD 1
    INVOKESTATIC kotlin/ResultKt.throwOnFailure (Ljava/lang/Object;)V
   L6
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.p$ : Lkotlinx/coroutines/CoroutineScope;
    ASTORE 2
   L7
    LINENUMBER 820 L7
    ICONST_0
    ISTORE 3
    BIPUSH 100
    ISTORE 4
   L8
    ILOAD 3
    ILOAD 4
    IF_ICMPGT L9
   L10
    LINENUMBER 821 L10
    LDC 10
    ALOAD 0
    ALOAD 0
    ALOAD 2
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.L$0 : Ljava/lang/Object;
    ALOAD 0
    ILOAD 3
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$0 : I
    ALOAD 0
    ILOAD 4
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$1 : I
    ALOAD 0
    ICONST_1
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.label : I
    INVOKESTATIC kotlinx/coroutines/DelayKt.delay (JLkotlin/coroutines/Continuation;)Ljava/lang/Object;
   L11
    DUP
    ALOAD 5
    IF_ACMPNE L12
   L13
    LINENUMBER 819 L13
    ALOAD 5
    ARETURN
   L3
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$1 : I
    ISTORE 4
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$0 : I
    ISTORE 3
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.L$0 : Ljava/lang/Object;
    CHECKCAST kotlinx/coroutines/CoroutineScope
    ASTORE 2
   L14
    NOP
    ALOAD 1
    INVOKESTATIC kotlin/ResultKt.throwOnFailure (Ljava/lang/Object;)V
    ALOAD 1
   L12
    LINENUMBER 822 L12
    POP
    NOP
   L15
    INVOKESTATIC kotlinx/coroutines/Dispatchers.getMain ()Lkotlinx/coroutines/MainCoroutineDispatcher;
    CHECKCAST kotlin/coroutines/CoroutineContext
    NEW com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1$1
    DUP
    ALOAD 0
    ALOAD 3
    ACONST_NULL
    INVOKESPECIAL com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1$1.<init> (Lcom/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1;Lkotlin/jvm/internal/Ref$IntRef;Lkotlin/coroutines/Continuation;)V
    CHECKCAST kotlin/jvm/functions/Function2
    ALOAD 0
    ALOAD 0
    ALOAD 2
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.L$0 : Ljava/lang/Object;
    ALOAD 0
    ILOAD 3
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$0 : I
    ALOAD 0
    ILOAD 4
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$1 : I
    ALOAD 0
    ICONST_2
    PUTFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.label : I
    INVOKESTATIC kotlinx/coroutines/BuildersKt.withContext (Lkotlin/coroutines/CoroutineContext;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
   L16
    DUP
    ALOAD 5
    IF_ACMPNE L17
   L18
    LINENUMBER 819 L18
    ALOAD 5
    ARETURN
   L4
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$1 : I
    ISTORE 4
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.I$0 : I
    ISTORE 3
    ALOAD 0
    GETFIELD com/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1.L$0 : Ljava/lang/Object;
    CHECKCAST kotlinx/coroutines/CoroutineScope
    ASTORE 2
   L19
    NOP
    ALOAD 1
    INVOKESTATIC kotlin/ResultKt.throwOnFailure (Ljava/lang/Object;)V
    ALOAD 1
   L17
    LINENUMBER 820 L17
    POP
    NOP
   L20
    IINC 3 1
   L21
    GOTO L8
   L9
    LINENUMBER 826 L9
    GETSTATIC kotlin/Unit.INSTANCE : Lkotlin/Unit;
    ARETURN
   L5
    NEW java/lang/IllegalStateException
    DUP
    LDC "call to 'resume' before 'invoke' with coroutine"
    INVOKESPECIAL java/lang/IllegalStateException.<init> (Ljava/lang/String;)V
    ATHROW
    RETURN
   L22
    LOCALVARIABLE $this$launch Lkotlinx/coroutines/CoroutineScope; L7 L5 2
    LOCALVARIABLE i I L10 L21 3
    LOCALVARIABLE this Lcom/letsaspire/android/payment/application/view/PaymentFragment$checkPaymentResponse$1; L0 L22 0
    LOCALVARIABLE $result Ljava/lang/Object; L0 L22 1
    MAXSTACK = 6
    MAXLOCALS = 6

File is unknown
The root cause java.lang.AssertionError was thrown at: org.jetbrains.kotlin.codegen.optimization.MethodVerifier.transform(MethodVerifier.kt:28)
    at org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:92)
    at org.jetbrains.org.objectweb.asm.MethodVisitor.visitEnd(MethodVisitor.java:778)
    at org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:90)
    ... 96 more
Caused by: java.lang.AssertionError: AFTER mandatory stack transformations: incorrect bytecode
    at org.jetbrains.kotlin.codegen.optimization.MethodVerifier.transform(MethodVerifier.kt:28)
    at org.jetbrains.kotlin.codegen.optimization.transformer.CompositeMethodTransformer.transform(CompositeMethodTransformer.kt:25)
    at org.jetbrains.kotlin.codegen.optimization.OptimizationMethodVisitor.performTransformations(OptimizationMethodVisitor.kt:62)
    at org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:70)
    ... 98 more
Caused by: java.lang.RuntimeException: org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException: Error at instruction 76: Expected an object reference, but found I
    at org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer.runAnalyzer(MethodTransformer.java:34)
    at org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer.analyze(MethodTransformer.java:44)
    at org.jetbrains.kotlin.codegen.optimization.MethodVerifier.transform(MethodVerifier.kt:26)
    ... 101 more
Caused by: org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException: Error at instruction 76: Expected an object reference, but found I
    at org.jetbrains.org.objectweb.asm.tree.analysis.Analyzer.analyze(Analyzer.java:291)
    at org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer.runAnalyzer(MethodTransformer.java:31)
    ... 103 more
Caused by: org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException: Expected an object reference, but found I
    at org.jetbrains.org.objectweb.asm.tree.analysis.BasicVerifier.copyOperation(BasicVerifier.java:90)
    at org.jetbrains.org.objectweb.asm.tree.analysis.BasicVerifier.copyOperation(BasicVerifier.java:43)
    at org.jetbrains.org.objectweb.asm.tree.analysis.Frame.execute(Frame.java:288)
    at org.jetbrains.org.objectweb.asm.tree.analysis.Analyzer.analyze(Analyzer.java:187)
    ... 104 more

Caused by: java.lang.AssertionError: AFTER mandatory stack transformations: incorrect bytecode

Caused by: java.lang.RuntimeException: org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException: Error at instruction 76: Expected an object reference, but found I

Caused by: org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException: Error at instruction 76: Expected an object reference, but found I

Caused by: org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException: Expected an object reference, but found I

> Task :app:compileDebugKotlin FAILED
hellosagar commented 3 years ago

facing this error

morefreefg commented 3 years ago

facing this error

Facing same error, how to solve?

mochadwi commented 2 years ago

This is also happened in our CI