[cls] include annotation arguments in cls stubs

^ KTIJ-24666
this would allow to build fir based on stubs,
do not keep ProtoBuf in memory and
search in decompiled code by stubs
This commit is contained in:
Anna Kozlova
2023-04-13 12:15:23 +02:00
parent f0af7c4228
commit 7ee648a4f5
19 changed files with 452 additions and 168 deletions
@@ -36,7 +36,7 @@ abstract class AbstractBinaryClassAnnotationLoader<A : Any, S : AbstractBinaryCl
result: MutableList<A>
): KotlinJvmBinaryClass.AnnotationArgumentVisitor?
protected abstract fun loadTypeAnnotation(proto: ProtoBuf.Annotation, nameResolver: NameResolver): A
abstract override fun loadAnnotation(proto: ProtoBuf.Annotation, nameResolver: NameResolver): A
protected fun loadAnnotationIfNotSpecial(
annotationClassId: ClassId,
@@ -194,11 +194,11 @@ abstract class AbstractBinaryClassAnnotationLoader<A : Any, S : AbstractBinaryCl
}
override fun loadTypeAnnotations(proto: ProtoBuf.Type, nameResolver: NameResolver): List<A> {
return proto.getExtension(JvmProtoBuf.typeAnnotation).map { loadTypeAnnotation(it, nameResolver) }
return proto.getExtension(JvmProtoBuf.typeAnnotation).map { loadAnnotation(it, nameResolver) }
}
override fun loadTypeParameterAnnotations(proto: ProtoBuf.TypeParameter, nameResolver: NameResolver): List<A> {
return proto.getExtension(JvmProtoBuf.typeParameterAnnotation).map { loadTypeAnnotation(it, nameResolver) }
return proto.getExtension(JvmProtoBuf.typeParameterAnnotation).map { loadAnnotation(it, nameResolver) }
}
protected fun findClassWithAnnotationsAndInitializers(
@@ -309,6 +309,12 @@ abstract class AbstractBinaryClassAnnotationLoader<A : Any, S : AbstractBinaryCl
}
}
class AnnotationsContainerWithConstants<out A, out C>(
override val memberAnnotations: Map<MemberSignature, List<A>>,
val propertyConstants: Map<MemberSignature, C>,
val annotationParametersDefaultValues: Map<MemberSignature, C>
) : AbstractBinaryClassAnnotationLoader.AnnotationsContainer<A>()
fun getPropertySignature(
proto: ProtoBuf.Property,
nameResolver: NameResolver,