Accepted answer

@documented is a meta-annotation. you apply @documented when defining an annotation, to ensure that classes using your annotation show this in their generated javadoc. i've not seen much use of it, but there is an example here. an earlier question suggests that it doesn't work automatically in eclipse, but i've tested in eclipse 3.6, and my annotations appear in the javadoc popups whether or not i attach the @documented annotation to them.

here's an example from spring, which ensures that transactional methods are marked as such in the javadoc:

@target({elementtype.method, elementtype.type})
public @interface transactional {


i found a useful page in the java tutorials which gives examples and more explanation for a number of standard annotations, including one use of @documented. specifically, look at the note block at the bottom for the preamble example (section documentation).


if some our annotation (for example, @inwork) is @documented, then for every class having that @inwork annotation the text generated by javadoc will contain @inwork text, as a reference to the annotation.


@inherited  // for descenders of the annotation to have the @documented feature automatically
@retention(retentionpolicy.runtime) // must be there
public @interface inwork {
    string value();

annotated target:

 * annotated class.
@inwork(value = "")
public class mainapp {...}

the javadoc text:

enter image description here

so, you have to decide, if the annotation should be shown in the javadoc text, and if yes, set @documented to it.

the information above is taken from oracle documentation.

please, notice, that in eclipse you'll see in javadoc generated text all annotations, are they @documented, or not.

it is still correct for 4.3 version.

Related Query

More Query from same tag