Annotations in Kotlin can have different use-site targets as explained here: https://kotlinlang.org/docs/reference/annotations.html#annotation-use-site-targets
My question is: When use-site is not explicitly defined, what is the default target when annotating property in a class like in the example below?
class Test {
@SomeAnnotation
var someProperty: String? = null
}
Background
I'm trying Jongo as MongoDB client in Kotlin and have problems annotating id field. Jongo does not map id property correctly when it's annotated like this:
@MongoId @MongoObjectId var id: String? = null
The annotations in question are just meta-annotations for Jackson. However it seems to work when I annotate the property like this, indicating use-site problem:
@field:[MongoId MongoObjectId]
var id: String? = null
I would expect that @field
is default use-site, but it seems that it isn't.