Java - Documented Annotation Type

Introduction

Documented annotation type is a marker meta-annotation type.

If an annotation type is marked with a Documented annotation, the Javadoc tool will generate documentation for all of its instances.

In the following code Version annotation type is annotated with a Documented meta-annotation.

import java.lang.annotation.Documented;
@Documented
@interface Version {
        int major();
        int minor();
}

Suppose you annotate a Test class with your Version annotation type as follows:

@Version(major=1, minor=0)
class Test {
}

When generating documentation for the Test class using the Javadoc, the Version annotation is also generated as part of the documentation.

By default the Test class documentation would not contain information about its Version annotation.