Why Can't I Evaluate Expressions When Debugging Kotlin Tests?


#1

From https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000162244-Why-Can-t-I-Evaluate-Expressions-When-Debugging-Kotlin-Tests

I have a gradle multi-project build with a mix of java and kotlin modules.

In one of the kotlin modules I have this

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
    kotlinOptions {
        languageVersion = "1.1"
        apiVersion = "1.1"
        jvmTarget = "1.8"
        javaParameters = true 
    }
}

Kotlin is a transitive dependency in my module.

|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.4
|    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.1.4
|    |    |    |    \--- org.jetbrains:annotations:13.0
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.4
|    |    |         \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.4 (*)
|    |    +--- org.jetbrains.kotlin:kotlin-reflect:1.1.4
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.4 (*)

However, whenever I try to evaluate an expression when debugging some tests I get this error:

Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option

In the IDEA project settings, every Kotlin facet has the target platform set to 1.8 and every module has the language level set to 8 (lamdas…) so why am I getting this error?

I don’t think it is https://youtrack.jetbrains.com/issue/KT-22227 because I see the settings from the build.gradle in the project settings as mentioned above.

IntelliJ IDEA 2018.1 (Community Edition)
Build #IC-181.4203.550, built on March 26, 2018
JRE: 1.8.0_152-release-1136-b20 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.13.0-37-generic

Kotlin 1.2.31-release-IJ2018.1-1