Converting package level Java annotation to Kotlin


#1

Is it possible to convert a package level Java annotation to Kotlin?

Java annotation (MyAnnotation.java):

package com.myexample.annotation;

@Retention(RUNTIME) @Target(PACKAGE)
public @interface MyAnnotation {

}

Application of annotation (package-info.java)

@MyAnnotation
package com.myexample

The following does not seem to work (although it does compile) - my annotation processor does not detected any of the classes in the package com.myexample:

MyAnnotation.kt

package com.myexample.annotation

@Target(allowedTargets = [AnnotationTarget.CLASS, AnnotationTarget.FILE])
@Retention(AnnotationRetention.SOURCE)
annotation class MyAnnotation

package-info.kt

@file:MyAnnotation
package com.myexample

import com.myexample.annotation.MyAnnotation