本文整理匯總了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;
}