本文整理汇总了Java中com.sun.tools.javac.util.ListBuffer.toList方法的典型用法代码示例。如果您正苦于以下问题:Java ListBuffer.toList方法的具体用法?Java ListBuffer.toList怎么用?Java ListBuffer.toList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.javac.util.ListBuffer
的用法示例。
在下文中一共展示了ListBuffer.toList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseFiles
import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
/**
* Parses a list of files.
*/
public List<JCCompilationUnit> parseFiles(Iterable<JavaFileObject> fileObjects) {
if (shouldStop(CompileState.PARSE))
return List.nil();
//parse all files
ListBuffer<JCCompilationUnit> trees = lb();
Set<JavaFileObject> filesSoFar = new HashSet<JavaFileObject>();
for (JavaFileObject fileObject : fileObjects) {
if (!filesSoFar.contains(fileObject)) {
filesSoFar.add(fileObject);
trees.append(parse(fileObject));
}
}
return trees.toList();
}
示例2: parseParams
import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
List<JCTree> parseParams(String s) throws ParseException {
if (s.trim().isEmpty())
return List.nil();
JavacParser p = fac.newParser(s.replace("...", "[]"), false, false, false);
ListBuffer<JCTree> paramTypes = new ListBuffer<JCTree>();
paramTypes.add(p.parseType());
if (p.token().kind == TokenKind.IDENTIFIER)
p.nextToken();
while (p.token().kind == TokenKind.COMMA) {
p.nextToken();
paramTypes.add(p.parseType());
if (p.token().kind == TokenKind.IDENTIFIER)
p.nextToken();
}
if (p.token().kind != TokenKind.EOF)
throw new ParseException("dc.ref.unexpected.input");
return paramTypes.toList();
}
示例3: getClasses
import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
/**
* Return a list of all classes contained in this package, including
* member classes of those classes, and their member classes, etc.
*/
private List<ClassDocImpl> getClasses(boolean filtered) {
if (allClasses != null && !filtered) {
return allClasses;
}
if (allClassesFiltered != null && filtered) {
return allClassesFiltered;
}
ListBuffer<ClassDocImpl> classes = new ListBuffer<ClassDocImpl>();
for (Scope.Entry e = sym.members().elems; e != null; e = e.sibling) {
if (e.sym != null) {
ClassSymbol s = (ClassSymbol)e.sym;
ClassDocImpl c = env.getClassDoc(s);
if (c != null && !c.isSynthetic())
c.addAllClasses(classes, filtered);
}
}
if (filtered)
return allClassesFiltered = classes.toList();
else
return allClasses = classes.toList();
}
示例4: Reference
import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
public ReferenceTree Reference(ExpressionTree qualExpr, CharSequence member, List<? extends Tree> paramTypes) {
com.sun.tools.javac.util.List<JCTree> paramTypesList = null;
if (paramTypes != null) {
ListBuffer<JCTree> lbl = new ListBuffer<>();
for (Tree t : paramTypes) {
lbl.append((JCTree) t);
}
paramTypesList = lbl.toList();
}
return docMake.at(NOPOS).newReferenceTree("", (JCExpression) qualExpr, member != null ? (Name) names.fromString(member.toString()) : null, paramTypesList);
}
示例5: asInstTypes
import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
List<Type> asInstTypes(List<Type> ts) {
ListBuffer<Type> buf = new ListBuffer<>();
for (Type t : ts) {
buf.append(asInstType(t));
}
return buf.toList();
}
示例6: filterVars
import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
private List<Type> filterVars(Filter<UndetVar> fu) {
ListBuffer<Type> res = new ListBuffer<>();
for (Type t : undetvars) {
UndetVar uv = (UndetVar)t;
if (fu.accepts(uv)) {
res.append(uv.qtype);
}
}
return res.toList();
}
示例7: fixConstructorNames
import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
void fixConstructorNames(JCClassDecl baseDecl) {
ListBuffer<JCTree> newMembers = new ListBuffer<>();
List<JCTree> members = baseDecl.getMembers();
Name name = baseDecl.getSimpleName();
for (JCTree memberDecl : members) {
JCTree newDecl = memberDecl;
if (memberDecl instanceof JCMethodDecl) {
JCMethodDecl methodDecl = (JCMethodDecl)memberDecl;
JCTree retTypeTree = methodDecl.getReturnType();
if (retTypeTree == null)
newDecl = make.MethodDef(
methodDecl.getModifiers(),
name,
(JCExpression)methodDecl.getReturnType(),
methodDecl.getTypeParameters(),
methodDecl.getReceiverParameter(),
methodDecl.getParameters(),
methodDecl.getThrows(),
methodDecl.getBody(),
(JCExpression)methodDecl.getDefaultValue());
}
newMembers.add(newDecl);
}
baseDecl.defs = newMembers.toList();
}
示例8: listClasses
import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
/**
* From a list of top level trees, return the list of contained class definitions
*/
List<JCClassDecl> listClasses(List<JCCompilationUnit> trees) {
ListBuffer<JCClassDecl> result = new ListBuffer<JCClassDecl>();
for (JCCompilationUnit t : trees) {
for (JCTree def : t.defs) {
if (def.hasTag(JCTree.Tag.CLASSDEF))
result.append((JCClassDecl)def);
}
}
return result.toList();
}
示例9: copy
import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
public <T extends JCTree> List<T> copy(List<T> trees, P p) {
if (trees == null)
return null;
ListBuffer<T> lb = new ListBuffer<>();
for (T tree: trees)
lb.append(copy(tree, p));
return lb.toList();
}
示例10: getComments
import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
private List<Comment> getComments(Comment.CommentStyle style) {
if (comments == null) {
return List.nil();
} else {
ListBuffer<Comment> buf = new ListBuffer<>();
for (Comment c : comments) {
if (c.getStyle() == style) {
buf.add(c);
}
}
return buf.toList();
}
}
示例11: erasedSupertypes
import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
List<Type> erasedSupertypes(Type t) {
ListBuffer<Type> buf = lb();
for (Type sup : closure(t)) {
if (sup.tag == TYPEVAR) {
buf.append(sup);
} else {
buf.append(erasure(sup));
}
}
return buf.toList();
}
示例12: blockTags
import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
/**
* Read a series of block tags, including their content.
* Standard tags parse their content appropriately.
* Non-standard tags are represented by {@link UnknownBlockTag}.
*/
protected List<DCTree> blockTags() {
ListBuffer<DCTree> tags = new ListBuffer<DCTree>();
while (ch == '@')
tags.add(blockTag());
return tags.toList();
}
示例13: withInferenceContext
import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
/** Creates an inference context given a list of type variables and performs the given action on it.
* The intention is to provide a way to do unit testing on inference contexts.
* @param typeVars a list of type variables to create the inference context from
* @param consumer the action to be performed on the inference context
*/
protected void withInferenceContext(List<Type> typeVars, Consumer<InferenceContext> consumer) {
Assert.check(!typeVars.isEmpty(), "invalid parameter, empty type variables list");
ListBuffer undetVarsBuffer = new ListBuffer();
typeVars.stream().map((tv) -> new UndetVar((TypeVar)tv, null, types)).forEach((undetVar) -> {
undetVarsBuffer.add(undetVar);
});
List<Type> undetVarsList = undetVarsBuffer.toList();
InferenceContext inferenceContext = new InferenceContext(infer, nil(), undetVarsList);
inferenceContext.rollback(undetVarsList);
consumer.accept(inferenceContext);
}
示例14: solveBasic
import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
List<Type> solveBasic(List<Type> varsToSolve, EnumSet<InferenceStep> steps) {
ListBuffer<Type> solvedVars = new ListBuffer<>();
for (Type t : varsToSolve.intersect(restvars())) {
UndetVar uv = (UndetVar)asUndetVar(t);
for (InferenceStep step : steps) {
if (step.accepts(uv, this)) {
uv.setInst(step.solve(uv, this));
solvedVars.add(uv.qtype);
break;
}
}
}
return solvedVars.toList();
}
示例15: freeVarsIn
import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
/**
* Returns a list of free variables in a given type
*/
final List<Type> freeVarsIn(Type t) {
ListBuffer<Type> buf = new ListBuffer<>();
for (Type iv : inferenceVars()) {
if (t.contains(iv)) {
buf.add(iv);
}
}
return buf.toList();
}