当前位置: 首页>>代码示例>>Java>>正文


Java List.appendList方法代码示例

本文整理汇总了Java中com.sun.tools.javac.util.List.appendList方法的典型用法代码示例。如果您正苦于以下问题:Java List.appendList方法的具体用法?Java List.appendList怎么用?Java List.appendList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.tools.javac.util.List的用法示例。


在下文中一共展示了List.appendList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: join

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private static <T> List<T> join(List<T> list1, List<T> list2) {
    return list1.appendList(list2);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:4,代码来源:JavacProcessingEnvironment.java

示例2: rewriteArrayType

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/**
 * Create a copy of the {@code Type type} with the help of the Tree for a type
 * {@code JCTree typetree} inserting all type annotations in {@code annotations} to the
 * innermost array component type.
 *
 * SIDE EFFECT: Update position for the annotations to be {@code pos}.
 */
private Type rewriteArrayType(ArrayType type, List<TypeCompound> annotations, TypeAnnotationPosition pos) {
    ArrayType tomodify = new ArrayType(type);
    ArrayType res = tomodify;

    List<TypePathEntry> loc = List.nil();

    // peel one and update loc
    Type tmpType = type.elemtype;
    loc = loc.prepend(TypePathEntry.ARRAY);

    while (tmpType.hasTag(TypeTag.ARRAY)) {
        ArrayType arr = (ArrayType)tmpType;

        // Update last type with new element type
        ArrayType tmp = new ArrayType(arr);
        tomodify.elemtype = tmp;
        tomodify = tmp;

        tmpType = arr.elemtype;
        loc = loc.prepend(TypePathEntry.ARRAY);
    }

    // Fix innermost element type
    Type elemType;
    if (tmpType.getMetadata() != null) {
        List<TypeCompound> tcs;
        if (tmpType.getAnnotationMirrors().isEmpty()) {
            tcs = annotations;
        } else {
            // Special case, lets prepend
            tcs =  annotations.appendList(tmpType.getAnnotationMirrors());
        }
        elemType = tmpType.cloneWithMetadata(tmpType
                .getMetadata()
                .without(Kind.ANNOTATIONS)
                .combine(new TypeMetadata.Annotations(tcs)));
    } else {
        elemType = tmpType.cloneWithMetadata(new TypeMetadata(new TypeMetadata.Annotations(annotations)));
    }
    tomodify.elemtype = elemType;

    // Update positions
    for (TypeCompound tc : annotations) {
        if (tc.position == null)
            tc.position = pos;
        tc.position.location = loc;
    }

    return res;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:58,代码来源:TypeAnnotations.java


注:本文中的com.sun.tools.javac.util.List.appendList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。