Hi! `@Layout(R.layout.album_medium)` `class AlbumV...
# ksp
h
Hi!
@Layout(R.layout.album_medium)
class AlbumViewHolder(view: View) : FlowHolder<Album>(view) ...
I have two problems 1.when I used KSAnnotated.annotations, I have got the int value of R.layout.album_medium, Is there any way to get the defined text? 2.I want to get Album class defined by Layout annotation. Could I get it from KSAnnotated? If not, what should I do?
y
1) i don't think so because the compiler will replace it with the final int value. You cannot use non compile time values in annotations (that code wouldn't compile in a library project) 2) you get them via get symbols annotated with API
h
I have try it by debug mode and I check all methods but I not find the api that get the generic from the superclass like
FlowHolder<Album>
let me put it another way,
FlowHolder<Album>
, the album class
j
You can traverse
KSClassDeclaration.superTypes
and then you can get the individual super types, from where you can call
KSTypeReference.resolve().declaration
to get the class declaration of these super types.
😀 1
h
Copy code
KSClassDeclaration.superTypes.toList().first()
    .resolve().arguments.first().type?.resolve()?.declaration
It works, thanks.