io.gitlab.arturbosch.detekt.rules.KtAnnotatedExtensions.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of detekt-psi-utils Show documentation
Show all versions of detekt-psi-utils Show documentation
Static code analysis for Kotlin
package io.gitlab.arturbosch.detekt.rules
import org.jetbrains.kotlin.psi.KtAnnotated
import org.jetbrains.kotlin.psi.KtAnnotationEntry
import org.jetbrains.kotlin.psi.KtUserType
fun KtAnnotated.hasAnnotation(
vararg annotationNames: String
): Boolean {
val names = annotationNames.toHashSet()
val predicate: (KtAnnotationEntry) -> Boolean = {
it.typeReference
?.typeElement
?.safeAs()
?.referencedName in names
}
return annotationEntries.any(predicate)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy