Declaring an annotation

suggest change

Annotations are means of attaching metadata to code. To declare an annotation, put the annotation modifier in front of a class:

annotation class Strippable

Annotations can have meta-anotations:

@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION)
    annotation class Strippable

Annotations, like other classes, can have constructors:

annotation class Strippable(val importanceValue: Int)

But unlike other classes, is limited to the following types:

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents