Correctly rearrange arguments for annotation constructors copied from another module

It won't fix KT-48181 completely, but it will allow to create such annotations
if all value arguments are specified.

For the full fix, we need to read default annotation values from classfiles in jar.

#KT-48181 In progress
This commit is contained in:
Leonid Startsev
2021-09-24 20:44:55 +03:00
committed by Space
parent 60cbfbf107
commit e7f1cef3a1
4 changed files with 53 additions and 2 deletions
@@ -0,0 +1,23 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM_IR
// WITH_RUNTIME
// !LANGUAGE: +InstantiationOfAnnotationClasses
fun f(): Metadata = Metadata(
kind = 0,
metadataVersion = intArrayOf(),
data1 = arrayOf(),
data2 = arrayOf(),
extraString = "",
packageName = "foo",
extraInt = 0,
bytecodeVersion = intArrayOf(1, 0, 3),
)
fun box(): String {
val m = f()
if (m.toString() == """@kotlin.Metadata(bytecodeVersion=[1, 0, 3], data1=[], data2=[], extraInt=0, extraString=, kind=0, metadataVersion=[], packageName=foo)""")
return "OK"
return m.toString()
}