Annotations.java 文件源码

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

项目:GitHub 作者:
static boolean annotationMatchesTarget(Element annotationElement, ElementType elementType) {
  @Nullable Target target = annotationElement.getAnnotation(Target.class);
  if (target != null) {
    ElementType[] targetTypes = target.value();
    if (targetTypes.length == 0) {
      return false;
    }
    boolean found = false;
    for (ElementType t : targetTypes) {
      if (t == elementType) {
        found = true;
      }
    }
    if (!found) {
      return false;
    }
  }
  return true;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号