title: Confused how ajc works with javac
body: <p>I'm a little confused how the AspectJ compiler, <code>ajc</code> works.  To my understanding when talking about CTW, ajc is used to weave aspects into the compiled byte-code - ie: the .class file.</p>
  
  <p>However, when I look at the maven-plugin for AspectJ (<code>aspectj-maven-plugin</code>), it turns out that it is run in the <code>generate-sources</code> phase of maven, before the javac compiler.  Which would imply that the compiler runs after the aspect weaving.  That kind of makes sense, since you can weave in ITDs, modifying class members, etc. which the java compiler would need to know about in order to compile any dependent classes.</p>
  
  <p>So if that is the case, and <code>ajc</code> runs before javac, I presume that <code>ajc</code> must first compile all the java code into byte code to be able to weave in any aspects.</p>
  
  <p>So the question is, if <code>ajc</code> already goes through the efforts of compiling all the java code into byte code, why does javac even need to run at all?  Why isn't <code>ajc</code> the only compiler that is required?  Isn't having both run just duplicating the efforts?  Additionally, how does <code>javac</code> handle the classes that <code>ajc</code> has already compiled?  Does it just ignore them since there is no change in the source file since the .class file was generated?</p>