本文整理汇总了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);
}
示例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;
}