InvalidTargetingOnScopingAnnotation.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:error-prone 作者:
@Override
public final Description matchClass(ClassTree classTree, VisitorState state) {
  if (ANNOTATION_WITH_SCOPE_AND_TARGET.matches(classTree, state)) {
    MultiMatchResult<AnnotationTree> targetAnnotation =
        HAS_TARGET_ANNOTATION.multiMatchResult(classTree, state);
    if (targetAnnotation.matches()) {
      AnnotationTree targetTree = targetAnnotation.onlyMatchingNode();
      Target target = getAnnotation(classTree, Target.class);
      if (target != null
          && // Unlikely to occur, but just in case Target isn't on the classpath.
          !Arrays.asList(target.value()).containsAll(REQUIRED_ELEMENT_TYPES)) {
        return describeMatch(targetTree, replaceTargetAnnotation(target, targetTree));
      }
    }
  }
  return Description.NO_MATCH;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号