EditorAnnotationsSupport

Contents

Annotation Processing Support in Other IDEs

IntelliJ Idea Community Edition (version 9.0 BETA)

Basic support for annotation processing implemented without an editor integration.

In the Project Settings dialog, user can

  • Enable annotation processing
  • Select to obtain processors from project classpath or set the explicit processor path
  • Add a processor class name to the annotation processors list
  • Add a module with annotated classes to the list of modules to process

Annotation processors are run every time the Make or Compile actions are invoked. Messages (errors and warnings) produced by annotation processors are not displayed in editor. Also, source files generated by annotation processors are not indexed until they are explicitly added to the project sourcepath.

Eclipse Galileo

Support for annotation processing implemented with an editor integration.

In the Project Properties dialog, user can

  • Enable annotation processing
  • Enable annotation processing in editor
  • Specify directory for genareted sources
  • Select plug-ins and JARs that contain annotation processors
  • Specify options passed to annotation processors

Messages (errors and warnings) produced by annotation processors are displayed in editor immediately once the respective annotations are typed. Source files produced by annotation processors are generated and indexed on the Build Project action invocation.

Annotation Processing Support in NetBeans

Basic support for annotation processing implemented without convenient options support and editor integration.

In the Project Properties dialog, user can

  • Disable annotation processing by passing '-proc:none' to the list of additional compiler options
  • Set the explicit processor path by passing '-processorpath <path>' to the list of additional compiler options
  • Specify the annotation processors list by passing '-processor <class1>[,<class2>...]' to the list of additional compiler options.

Annotation processors are run every time the Build Project action is invoked. Messages (errors and warnings) produced by annotation processors are not displayed in editor. Also, source files generated by annotation processors are not indexed until they are explicitly added to the project sourcepath.

Annotation Processing options

Similarly to Eclipse or Idea, the new panel should be added to the Project Properties dialog that allows for more convenient way of specifying the annotation processing options.

Editor support for annotation processing

When thinking about the editor support for annotation processors, three basic groups of processors can be identified. Let's call them

  • message producers
  • file generators
  • generic processors

Message produces

Annotation processors producing messages (errors and warnings) through the Messager interface. These annotation processors are easiest to support. Only two principal questions should be answered

  • when to run these processors?
    • should be run with each document modification???
  • how to run these processors?
    • using the standard javac support (problem: slow processor could hinder a higher priority task in accessing parser result)
    • using the editor hints support

File generators

Annotation processors generating files through the Filer interface.

  • when to run these processors?
    • should be run on each document save???
  • how to run these processors?
    • using the standard javac support
    • using the specialized custom indexer
  • where to put generated files?
    • specified directory under project
    • caches
  • how and when to clean generated files?
    •  ???

Generic processors

   ????

Open issues

  • Support for pre JDK1.6 annotation processors based on the old APT API.
  • JSR 308 support
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo