Support array class literals in annotation serializer/deserializer

Note that this change brings an incompatibility: `Array<Foo>::class`
will be seen as `Foo::class` by the old deserializer. We consider this
OK because the compiler never had any logic that relied on reading class
literal arguments correctly (otherwise it wouldn't have worked because
it could only see `Array<*>::class` before this commit), and the support
of annotations on types in JVM reflection is only available in the
upcoming 1.3 release (KT-16795)

 #KT-22069 Fixed
This commit is contained in:
Alexander Udalov
2018-09-04 18:24:01 +03:00
parent f3f93ed6cc
commit f90303315d
11 changed files with 549 additions and 189 deletions
@@ -11,6 +11,13 @@ class A {
fun simple(s: @Ann(Simple::class) String) {}
fun generic(s: @Ann(Generic::class) String) {}
fun innerGeneric(s: @Ann(InnerGeneric.Inner::class) String) {}
fun arrays(
s: @Ann(Array<Int>::class) Array<Int>,
t: @Ann(Array<IntArray>::class) Array<IntArray>,
u: @Ann(Array<Array<Int>>::class) Array<Array<Int>>,
v: @Ann(Array<Array<Array<String>>>::class) Array<Array<Array<String>>>
) {}
}
class Simple
@@ -2,6 +2,7 @@ package test
public final class A {
/*primary*/ public constructor A()
public final fun arrays(/*0*/ s: @test.Ann(klass = kotlin.Array<kotlin.Int>::class) kotlin.Array<kotlin.Int>, /*1*/ t: @test.Ann(klass = kotlin.Array<kotlin.IntArray>::class) kotlin.Array<kotlin.IntArray>, /*2*/ u: @test.Ann(klass = kotlin.Array<kotlin.Array<kotlin.Int>>::class) kotlin.Array<kotlin.Array<kotlin.Int>>, /*3*/ v: @test.Ann(klass = kotlin.Array<kotlin.Array<kotlin.Array<kotlin.String>>>::class) kotlin.Array<kotlin.Array<kotlin.Array<kotlin.String>>>): kotlin.Unit
public final fun generic(/*0*/ s: @test.Ann(klass = test.Generic<*>::class) kotlin.String): kotlin.Unit
public final fun innerGeneric(/*0*/ s: @test.Ann(klass = test.InnerGeneric<*, *>.Inner<*, *>::class) kotlin.String): kotlin.Unit
public final fun simple(/*0*/ s: @test.Ann(klass = test.Simple::class) kotlin.String): kotlin.Unit