posted 9 years ago
Retention policies specify until when an annotation should be retained.
SOURCE means that the annotation is thrown away after the compiler has compiled it to byte-code. That means that the .class knows nothing about the annotation.
COMPILE means that the annotation is included in the byte-code. You can inspect classes and find the annotation. The annotation is thrown away when you run the JVM.
RUNTIME means that the annotation is available inside the JVM. You can use reflection to find it.
If an annotation doesn't exist, you will never be able to compile the code. This has nothing to do with retention policies.