コード例 #1
0
  private void validateClassAnnotation(IClassDefinition definition, IMetaTag tag) {
    IAnnotationDefinition annotation = manager.getAnnotation(tag);
    if (annotation == null) {
      // XXX (Annotation) AnnotationNotDefinedProblem
      manager.addProblem(new AnnotationProblem(definition));
      return;
    }

    if (!annotation.isValidTarget(definition)) {
      // XXX (Annotation) InvlaidTargetForAnnotationProblem
      manager.addProblem(new AnnotationProblem(definition));
    }
  }
コード例 #2
0
  private void validateMemberAnnotation(IDefinition definition, IMetaTag tag) {
    IAnnotationDefinition annotation = manager.getAnnotation(tag);
    if (annotation == null) {
      // XXX (Annotation) AnnotationNotDefinedProblem
      manager.addProblem(new AnnotationProblem(definition));
      return;
    }

    if (!annotation.isValidTarget(definition)) {
      // XXX (Annotation) InvlaidTargetForAnnotationProblem
      manager.addProblem(
          new InvlaidTargetForAnnotationProblem(tag, "method", annotation.getQualifiedName()));
    }
  }