Annotation Processing

Annotation processors are utility programs that can generate additional Java code or other files, and produce problem markers, based on Java 5 (JSR-175) annotations. Processors can be based on either the Java 5 Mirror APIs or the Java 6 annotation processing APIs. The Annotation Processing preference pane permits configuration of preferences that apply to all processors in a project or workspace. The Factory Path preference pane specifies which processors are enabled and permits configuration of individual processors.

Enable annotation processing

Annotation processing is turned off by default, and must be turned on by checking this checkbox for each project that needs it. It is only necessary to enable annotation processing in a project in order to have annotation processors operate on that project's code. The mere presence of annotations in code does not mean that annotation processing is required; for example, the @Deprecated and @Override annotations do not typically require processing.

Enable processing in editor

When this option is enabled, processors will run whenever changes are made in the Java editor, as well as whenever the project is built. Enabling processors to run in the editor allows them to generate contribute errors and warnings as you type. For instance, processors can red-squiggle a bad annotation value to indicate a semantic problem that the compiler alone would not be able to discover. However, some annotation processors are slow enough that running them in the editor interferes with the usability of the editor. In this situation, disabling this option can improve performance of the editor. Processors will still run whenever the project is built. This option does not apply to Java 6 annotation processors, which Eclipse can (for now) only run during a build.

Generated source directory

Files will be generated on disk relative to the specified directory. By default this directory is named ".apt_generated", which since it starts with a '.' causes it to be filtered out of the Package Explorer view. Generated files have the "derived" bit set; when a project is cleaned, all derived files under the generated source directory will be removed. It is recommended to only use this directory for files generated by processors; do not place any manually created files under this directory, and do not use a pre-existing directory as the generated source directory.

Processor options

Options entered here will be available via the AnnotationProcessorEnvironment interface (for Java 5 processors) or the ProcessingEnvironment interface (for Java 6 processors). Certain options such as -classpath and -sourcepath are automatically provided to Java 5 processors; entering them in this dialog will have no effect, since the automatically provided values will override any values set here. For Java 6 processors, the values of these automatic options are made available as variables such as %classpath% and %sourcepath%. The automatic options are described here. More information about processor options is in the topic on the Processor Options input dialog.