Java Annotations - looking for an example of RetentionPolicy.CLASS

Viewed 9513

according to Java Annotation API:

  • RetentionPolicy.CLASS Annotations are to be recorded in the class file by the compiler but need not be retained by the VM at run time.

  • RetentionPolicy.RUNTIME Annotations are to be recorded in the class file by the compiler and retained by the VM at run time, so they may be read reflectively.

I am looking for a sample of "CLASS" retention policy. when we need to use this policy instead of RUNTIME policy.

4 Answers
Related