0

I can create a processor using Reflection to process the run-time level annotations, but how can i process the source level annotations using reflection?

1
  • 1
    Is there a reason not to use AbstractProcessor? Commented Sep 23, 2017 at 18:03

1 Answer 1

1

As the RetentionPolicy APIdoc states:

SOURCE

Annotations are to be discarded by the compiler.

So the answer is no. You either process annotation with @Retention(SOURCE) at compile time or they vanish.

If you process them at compile time implementing an AbstractProcessor and registring it via system properties or configuration of maven-compiler-plugin to the compiler is the usual way.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.