title: How to get field's type annotation in Java Annotation Processing?
body: <p>For example, I have this code:</p>
  
  <pre><code>@Retention(RetentionPolicy.SOURCE)
  public @interface ClassAnnotation {
  }
  
  @ClassAnnotation
  public class AnnotatedClass {
  }
  
  @ClassAnnotation
  public class AnotherAnnotatedClass {
  
      private AnnotatedClass someField;
      private int intIsNotAnnotated;
  }
  </code></pre>
  
  <p>And this processor to preprocess it in compile time:</p>
  
  <pre><code>@SupportedAnnotationTypes({ "com.example.ClassAnnotation" })
  @SupportedSourceVersion(SourceVersion.RELEASE_6)
  public class AwesomeProcessor extends AbstractProcessor {
  
      public boolean process(Set&lt;? extends TypeElement&gt; annotations,
              RoundEnvironment roundEnv) {
          // Skipped for brevity...
          // For each annotated class
          for (Element e : roundEnv.getElementsAnnotatedWith(ClassAnnotation.class)) {
              // Skipped for brevity...
              // For each field
              for (Element ee : classElement.getEnclosedElements()) {
                  // Skipped for brevity... (of course there's kind checking)
                  TypeMirror fieldType = fieldElement.asType();
                  TypeElement fieldTypeElement = (TypeElement) processingEnv.
                      getTypeUtils().asElement(fieldType);
              }
          }
          // Skipped for brevity
      }
  }
  </code></pre>
  
  <p>I need to check whether a field's type is a class that is annotated with my annotation. Somehow I've got a <code>TypeElement</code> named <code>fieldTypeElement</code>, it may represent <code>AnnotatedClass</code> from <code>someField</code> or <code>int</code> from <code>intIsNotAnnotated</code> in the example. How to get <code>@ClassAnnotation</code> of <code>AnnotatedClass</code> of <code>someField</code>? I've tried <code>fieldTypeElement.getAnnotation(ClassAnnotation.class)</code> and <code>fieldTypeElement.getAnnotationMirrors()</code>, but it returns null and empty list respectively.</p>