title: The drawbacks of annotation processing in Java?
body: <p>I am considering starting a project which is used to generate code in Java using annotations (I won't get into specifics, as it's not really relevant). I am wondering about the validity and usefulness  of the project, and something that has struck me is the dependence on the Annontation Processor Tool (apt).</p>
  
  <p>What I'd like to know, as I can't speak from experience, is what are the drawbacks of using annotation processing in Java?</p>
  
  <p>These could be anything, including the likes of:  </p>
  
  <ul>
  <li>it is hard to do TDD when writing the processor</li>
  <li>it is difficult to include the processing on a build system</li>
  <li>processing takes a long time, and it is very difficult to get it to run fast</li>
  <li>using the annotations in an IDE requires a plugin for each, to get it to behave the same when reporting errors</li>
  </ul>
  
  <p>These are just examples, not my opinion. I am in the process of researching if any of these are true (including asking this question ;-) )</p>
  
  <p>I am sure there must be drawbacks (for instance, <a href="http://www.qi4j.org/" rel="nofollow noreferrer">Qi4J</a> specifically list not using pre-processors as an advantage) but I don't have the experience with it to tell what they are.</p>
  
  <p>The ony reasonable alternative to using annotation processing is probably to create plugins for the relevant IDEs to generate the code (it would be something vaguely similar to override/implement methods feature that would generate all the signatures without method bodies). However, that step would have to be repeated each time relevant parts of the code changes, annotation processing would not, as far as I can tell.</p>
  
  <p>In regards to the example given with the invasive amount of annotations, I don't envision the use needing to be anything like that, maybe a handful for any given class. That wouldn't stop it being abused of course.</p>