I created annotation in scala and used it as follows:
object Main extends App {
println(classOf[Annotated].getAnnotations.length)
import scala.reflect.runtime.universe._
val mirror = runtimeMirror(cls.getClassLoader)
}
final class TestAnnotation extends StaticAnnotation
@TestAnnotation
class Annotated
As it's a Scala annotation it can not be read using getAnnotations
on the other hand, scala-reflect
dependency isn't available anymore for scala 3.0, so we have no access to runtimeMirror
Is there any alternative solution to read an annotation value in scala?