How to get the value of a Constant used in an annotation from KtAnnotated?
Answered
I have an annotation as below
@MyAnnotation(name="foo", value="bar") but in some files I have @MyAnnotation(name=<ClassName>.FOO, value="bar"). I am trying to develop a plugin that will get “foo” for both cases. I can do it for the first case by getting KtAnnotationEntry, and then finding the argument expression text. How do I evaluate a class constant in the second case?
Please sign in to leave a comment.
Hi Kushal,
You can try: