Skip to content

Find methods with specific annotation. #4552

Answered by cortinico
WolandPL asked this question in Q&A
Discussion options

You must be logged in to vote

I would follow the same logic we have in the AnnotationSuppressor here:

if (this is KtAnnotated) {
val references = annotationEntries.mapNotNull { it.typeReference }
if (references.any { it.text in annotationNames }) {
return true
} else if (bindingContext != BindingContext.EMPTY) {
if (references.any { it.fqNameOrNull(bindingContext)?.toString() in annotationNames }) {
return true
}
}
}

Specifically if you're running with Type Resolution you can access to: .fqNameOrNull(bindingContext)?.toString()

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by WolandPL
Comment options

You must be logged in to vote
4 replies
@cortinico
Comment options

@WolandPL
Comment options

@cortinico
Comment options

@WolandPL
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants