org.jetbrains.kotlin.codegen.CompilationException

Back-end (JVM) Internal error: wrong code generated org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException Error at instruction 8: Cannot pop operand off an empty stack. Cause: Error at instruction 8: Cannot pop operand off an empty stack. File being compiled and position: (4,38) in /home/adiksonline/Documents/AndroidStudioProjects/Sample/app_sample/src/main/java/Sample.kt PsiElement: { println("Hello world $TAG") } The root cause was thrown at: MethodAnalyzer.kt:116

Samebug tips0

We couldn't find tips for this exception.

Don't give up yet. Paste your full stack trace to get a solution.

Solutions on the web7

Stack trace

  • org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: wrong code generated org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException Error at instruction 8: Cannot pop operand off an empty stack. Cause: Error at instruction 8: Cannot pop operand off an empty stack. File being compiled and position: (4,38) in /home/adiksonline/Documents/AndroidStudioProjects/Sample/app_sample/src/main/java/Sample.kt PsiElement: { println("Hello world $TAG") } The root cause was thrown at: MethodAnalyzer.kt:116 at org.jetbrains.kotlin.codegen.FunctionCodegen.endVisit(FunctionCodegen.java:531) at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:225) at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:145) at org.jetbrains.kotlin.codegen.ClosureCodegen.generateBody(ClosureCodegen.java:186) at org.jetbrains.kotlin.codegen.MemberCodegen.generate(MemberCodegen.java:118) at org.jetbrains.kotlin.codegen.ExpressionCodegen.genClosure(ExpressionCodegen.java:1560) at org.jetbrains.kotlin.codegen.ExpressionCodegen.genClosure(ExpressionCodegen.java:1536) at org.jetbrains.kotlin.codegen.ExpressionCodegen.genSamInterfaceValue(ExpressionCodegen.java:2462) at org.jetbrains.kotlin.codegen.ExpressionCodegen.visitCallExpression(ExpressionCodegen.java:2446) at org.jetbrains.kotlin.codegen.ExpressionCodegen.visitCallExpression(ExpressionCodegen.java:110) at org.jetbrains.kotlin.psi.KtCallExpression.accept(KtCallExpression.java:35) at org.jetbrains.kotlin.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:283) at org.jetbrains.kotlin.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:265) at org.jetbrains.kotlin.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:308) at org.jetbrains.kotlin.codegen.MemberCodegen.initializeProperty(MemberCodegen.java:395) at org.jetbrains.kotlin.codegen.MemberCodegen.generateInitializers(MemberCodegen.java:371) at org.jetbrains.kotlin.codegen.ImplementationBodyCodegen.generateInitializers(ImplementationBodyCodegen.java:1099) at org.jetbrains.kotlin.codegen.ImplementationBodyCodegen.generatePrimaryConstructorImpl(ImplementationBodyCodegen.java:1038) at org.jetbrains.kotlin.codegen.ImplementationBodyCodegen.access$300(ImplementationBodyCodegen.java:92) at org.jetbrains.kotlin.codegen.ImplementationBodyCodegen$3.doGenerateBody(ImplementationBodyCodegen.java:946) at org.jetbrains.kotlin.codegen.FunctionGenerationStrategy$CodegenBased.generateBody(FunctionGenerationStrategy.java:72) at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethodBody(FunctionCodegen.java:378) at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:213) at org.jetbrains.kotlin.codegen.ImplementationBodyCodegen.generatePrimaryConstructor(ImplementationBodyCodegen.java:942) at org.jetbrains.kotlin.codegen.ImplementationBodyCodegen.generateConstructors(ImplementationBodyCodegen.java:397) at org.jetbrains.kotlin.codegen.ClassBodyCodegen.generateBody(ClassBodyCodegen.java:79) at org.jetbrains.kotlin.codegen.MemberCodegen.generate(MemberCodegen.java:118) at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:232) at org.jetbrains.kotlin.codegen.PackageCodegen.generateClassOrObject(PackageCodegen.java:145) at org.jetbrains.kotlin.codegen.PackageCodegen.generateFile(PackageCodegen.java:98) at org.jetbrains.kotlin.codegen.PackageCodegen.generate(PackageCodegen.java:61) 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.idea.internal.KotlinBytecodeToolWindow.compileSingleFile(KotlinBytecodeToolWindow.java:312) at org.jetbrains.kotlin.idea.internal.KotlinBytecodeToolWindow.getBytecodeForFile(KotlinBytecodeToolWindow.java:225) at org.jetbrains.kotlin.idea.internal.KotlinBytecodeToolWindow$UpdateBytecodeToolWindowTask.processRequest(KotlinBytecodeToolWindow.java:115) at org.jetbrains.kotlin.idea.internal.KotlinBytecodeToolWindow$UpdateBytecodeToolWindowTask.processRequest(KotlinBytecodeToolWindow.java:76) at org.jetbrains.kotlin.idea.util.LongRunningReadTask$1$1.run(LongRunningReadTask.java:110) at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:950) at org.jetbrains.kotlin.idea.util.LongRunningReadTask$3.run(LongRunningReadTask.java:226) at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:446) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127) at org.jetbrains.kotlin.idea.util.LongRunningReadTask.runWithWriteActionPriority(LongRunningReadTask.java:223) at org.jetbrains.kotlin.idea.util.LongRunningReadTask$1.run(LongRunningReadTask.java:105) at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369) 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) Caused by: org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException: Error at instruction 8: Cannot pop operand off an empty stack. at org.jetbrains.kotlin.codegen.optimization.common.MethodAnalyzer.analyze(MethodAnalyzer.kt:116) at org.jetbrains.kotlin.codegen.optimization.fixStack.FixStackMethodTransformer.transform(FixStackMethodTransformer.kt:43) at org.jetbrains.kotlin.codegen.optimization.MandatoryMethodTransformer.transform(MandatoryMethodTransforker.kt:29) at org.jetbrains.kotlin.codegen.optimization.OptimizationMethodVisitor.visitEnd(OptimizationMethodVisitor.java:81) at org.jetbrains.org.objectweb.asm.MethodVisitor.visitEnd(MethodVisitor.java:878) at org.jetbrains.kotlin.codegen.FunctionCodegen.endVisit(FunctionCodegen.java:519) ... 53 more Caused by: java.lang.IndexOutOfBoundsException: Cannot pop operand off an empty stack. at org.jetbrains.org.objectweb.asm.tree.analysis.Frame.pop(Frame.java:221) at org.jetbrains.kotlin.codegen.optimization.fixStack.FixStackAnalyzer$FixStackFrame.pop(FixStackAnalyzer.kt:112) at org.jetbrains.kotlin.codegen.optimization.fixStack.FixStackAnalyzer$FixStackFrame.pop(FixStackAnalyzer.kt:53) at org.jetbrains.org.objectweb.asm.tree.analysis.Frame.execute(Frame.java:615) at org.jetbrains.kotlin.codegen.optimization.fixStack.FixStackAnalyzer$FixStackFrame.execute(FixStackAnalyzer.kt:83) at org.jetbrains.kotlin.codegen.optimization.common.MethodAnalyzer.analyze(MethodAnalyzer.kt:85) ... 58 more

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

We couldn't find other users who have seen this exception.