KT-31291: KAPT - make sure ASM version is not inlined

Switch to Java reflection when getting the ASM version used
to analyze classes. Using Kotlin reflection resulted in the constant
being inlined.

Fixes KT-31291
Fixes KT-33493
This commit is contained in:
Ivan Gavrilovic
2019-08-28 13:51:58 +02:00
committed by Yan Zhulanow
parent 60fa632d02
commit 58efa34a33
@@ -15,7 +15,8 @@ const val metadataDescriptor: String = "Lkotlin/Metadata;"
*/
internal val lazyAsmApiVersion = lazy {
try {
Opcodes::API_VERSION.get()
val field = Opcodes::class.java.getField("API_VERSION")
field.get(null) as Int
} catch(e: Throwable) {
Opcodes.API_VERSION
}