ClassIndexProcessor.java 文件源码

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

项目:soklet 作者:
/**
 * Index super types for {@link IndexSubclasses} and any {@link IndexAnnotated}
 * additionally accompanied by {@link Inherited}.
 */
private void indexSupertypes(TypeElement rootElement, TypeElement element) throws IOException {

    for (TypeMirror mirror : types.directSupertypes(element.asType())) {
        if (mirror.getKind() != TypeKind.DECLARED) {
            continue;
        }

        DeclaredType superType = (DeclaredType) mirror;
        TypeElement superTypeElement = (TypeElement) superType.asElement();
        storeSubclass(superTypeElement, rootElement);

        for (AnnotationMirror annotationMirror : superTypeElement.getAnnotationMirrors()) {
            TypeElement annotationElement = (TypeElement) annotationMirror.getAnnotationType()
                    .asElement();

            if (hasAnnotation(annotationElement, Inherited.class)) {
                storeAnnotation(annotationElement, rootElement);
            }
        }

        indexSupertypes(rootElement, superTypeElement);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号