Kotlin rules cannot be compiled against abi jars
Created by: kageiit
f43e2d20 introduced a regression that puts abi jars on the kotlinc classpath instead of full jars. kotlinc
does not like this and errors out on compilation when using methods from the kotlin standard library with the following stacktrace
Caused by: java.lang.IllegalStateException: Couldn't obtain compiled function body for public inline fun <T> mutableListOf(): kotlin.collections.MutableList<T> defined in kotlin.collections[DeserializedSimpleFunctionDescriptor@727380c2]
at org.jetbrains.kotlin.codegen.inline.InlineCodegen$1.invoke(InlineCodegen.java:280)
at org.jetbrains.kotlin.codegen.inline.InlineCodegen$1.invoke(InlineCodegen.java:275)
at org.jetbrains.kotlin.codegen.inline.InlineCacheKt.getOrPut(InlineCache.kt:34)
at org.jetbrains.kotlin.codegen.inline.InlineCodegen.createMethodNode(InlineCodegen.java:274)
at org.jetbrains.kotlin.codegen.inline.InlineCodegen.genCallInner(InlineCodegen.java:180)
... 69 more
val words = mutableListOf<String>()
^
A repro case is available here: https://github.com/uber/okbuck/tree/gk_kotlin_abi
Command to run: ./buckw build //libraries/kotlinlibrary/...
After removing the compile_against_abis = true
change in .buckconfig
in the repro, everything works as expected
Seems like this option is not safe for kotlin modules yet. The kotlin compiler is actually introspecting the classes to extract out and inline the method into the compiled code. If we compile against the abi jars, the compiled method body will not be found. I think as part of refactoring and reusing base jvm descriptions etc for f43e2d20 , it inadvertently introduced kotlinc to be able to pickup abi jars for compilation
cc @dsyang @runningcode @brettwooldridge