As I know, @Documented
annotation is used only by javadoc generator to generate javadocs from sources. So retention type should be SOURCE
, but it's RUNTIME
. Why?
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface Documented {
}
IMO that does not explain why @Documented needs runtime retention
Yes, it does. Lets say I ship a jar file without the sources. A user can build a proper javadoc using only information from classfiles the the reason that classfile have proper annotations is becase they are RetentionPolicy.RUNTIME.