I’ve just faced a very strange problems with apply...
# announcements
m
I’ve just faced a very strange problems with applying an annotation to a field. I use two annotations. The first is defined in Java:
Copy code
@Target({ METHOD, CONSTRUCTOR, FIELD })
@Retention(RUNTIME)
@Documented
public @interface Inject {}
Another one is written in Kotlin:
Copy code
@Retention(AnnotationRetention.RUNTIME)
@Qualifier
annotation class EmptyQualifier
When I use these two annotations on a field, the Java annotation is applied to the field, while the Kotlin annotation is applied to a private synthetic accessor method for the field. However if I add
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FUNCTION, AnnotationTarget.FIELD)
to the Kotlin annotation, everything starts working as expected.