Is there any way to combine annotation classes, fo...
# getting-started
k
Is there any way to combine annotation classes, for example like this:
Copy code
import kotlin.reflect.full.hasAnnotation

annotation class Annotation1
annotation class Annotation2

@Annotation1
@Annotation2
annotation class CombinedAnnotation

@CombinedAnnotation class X

fun main() {
    println(X::class.hasAnnotation<Annotation1>())
}
That above prints "false". My inspiration is from Spring, which annotates the
@Service
annotation with
@Component
and the doc says that the former is a specialization of the latter (so every class annotated with
@Service
is treated as if it was also a
@Component
).
e
that requires walking through the annotations to see what meta-annotations they're annotated with etc.