PullUpTransformer.java 文件源码

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

项目:incubator-netbeans 作者:
private boolean deepSearchTypes(DeclaredType currentElement, TypeMirror orig, TypeMirror something, Map<TypeMirror, TypeParameterElement> mappings) {
    Types types = workingCopy.getTypes();
    List<? extends TypeMirror> directSupertypes = types.directSupertypes(currentElement);
    for (TypeMirror superType : directSupertypes) {
        DeclaredType type = (DeclaredType) superType;
        List<? extends TypeMirror> typeArguments = type.getTypeArguments();
        for (int i = 0; i < typeArguments.size(); i++) {
            TypeMirror typeArgument = typeArguments.get(i);
            if (something.equals(typeArgument)) {
                TypeElement asElement = (TypeElement) type.asElement();
                mappings.put(orig, asElement.getTypeParameters().get(i));
                if (types.erasure(targetType.asType()).equals(types.erasure(superType))) {
                    return true;
                }
                if(deepSearchTypes(type, orig, typeArgument, mappings)) {
                    break;
                }
            }
        }
        if (types.erasure(targetType.asType()).equals(types.erasure(superType))) {
            mappings.remove(orig);
            return true;
        }
    }
    return false;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号