本文整理了Java中com.sun.tools.javac.util.List.from()
方法的一些代码示例,展示了List.from()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。List.from()
方法的具体详情如下:
包路径:com.sun.tools.javac.util.List
类名称:List
方法名:from
[英]Construct a list consisting all elements of given array.
[中]构造一个由给定数组的所有元素组成的列表。
代码示例来源:origin: google/error-prone
/**
* Returns a {@code String} representation of a sequence of statements, with semicolons and
* newlines.
*/
private static String printStatements(Context context, Iterable<JCStatement> statements) {
StringWriter writer = new StringWriter();
try {
pretty(context, writer).printStats(com.sun.tools.javac.util.List.from(statements));
} catch (IOException e) {
throw new AssertionError("StringWriter cannot throw IOExceptions");
}
return writer.toString();
}
代码示例来源:origin: google/error-prone
/** Build an instance of a Type. */
public Type getType(Type baseType, boolean isArray, List<Type> typeParams) {
boolean isGeneric = typeParams != null && !typeParams.isEmpty();
if (!isArray && !isGeneric) {
// Simple type.
return baseType;
} else if (isArray && !isGeneric) {
// Array type, not generic.
ClassSymbol arraySymbol = getSymtab().arrayClass;
return new ArrayType(baseType, arraySymbol);
} else if (!isArray && isGeneric) {
// Generic type, not array.
com.sun.tools.javac.util.List<Type> typeParamsCopy =
com.sun.tools.javac.util.List.from(typeParams);
return new ClassType(Type.noType, typeParamsCopy, baseType.tsym);
} else {
throw new IllegalArgumentException("Unsupported arguments to getType");
}
}
代码示例来源:origin: google/error-prone
result.add(inliner.types().lub(List.from(exprTys)));
result.add(inliner.getBinding(key).type);
return List.from(result);
代码示例来源:origin: org.netbeans.api/org-openide-filesystems
cleanTrees.invoke(null, List.from(toClean.toArray(new JCTree[0])));
} catch (Throwable t) {
processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Failed with a Throwable: " + t.getMessage());
代码示例来源:origin: google/error-prone
result.add(key.method.returnType().inline(inliner));
return List.from(result);
代码示例来源:origin: google/error-prone
base.type,
name,
com.sun.tools.javac.util.List.from(argTypes),
com.sun.tools.javac.util.List.from(tyargTypes));
} catch (FatalError e) {
代码示例来源:origin: cincheo/jsweet
/**
* Transforms a Java iterable to a javac list.
*/
public static <T> com.sun.tools.javac.util.List<T> toJCList(Iterable<T> collection) {
return com.sun.tools.javac.util.List.from(collection);
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
public List<Attribute> getValue() {
return List.from(values);
}
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
public List<Attribute> getValue() {
return List.from(values);
}
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
代码示例来源:origin: sc.fiji/javac
public List<Attribute> getValue() {
return List.from(values);
}
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
代码示例来源:origin: konsoletyper/teavm-javac
public List<Attribute> getValue() {
return List.from(values);
}
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
代码示例来源:origin: uk.org.retep.tools/annotations
/**
* Generate a JCBlock from one or more statements
* @param pos position in source
* @param statements JCStatement's
* @return JCBlock
*/
public JCTree.JCBlock block( final int pos,
final JCTree.JCStatement... statements )
{
return block( pos, List.from( statements ) );
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
private void checkAccessibleTypes(final DiagnosticPosition pos, final Env<AttrContext> env,
final InferenceContext inferenceContext, final Type... ts) {
checkAccessibleTypes(pos, env, inferenceContext, List.from(ts));
}
代码示例来源:origin: com.google.errorprone/error_prone_core
/**
* Returns a {@code String} representation of a sequence of statements, with semicolons and
* newlines.
*/
private static String printStatements(Context context, Iterable<JCStatement> statements) {
StringWriter writer = new StringWriter();
try {
pretty(context, writer).printStats(com.sun.tools.javac.util.List.from(statements));
} catch (IOException e) {
throw new AssertionError("StringWriter cannot throw IOExceptions");
}
return writer.toString();
}
代码示例来源:origin: konsoletyper/teavm-javac
public CheckStuckPolicy(ResultInfo resultInfo, DeferredType dt) {
this.pt = resultInfo.pt;
this.inferenceContext = resultInfo.checkContext.inferenceContext();
scan(dt.tree);
if (!stuckVars.isEmpty()) {
resultInfo.checkContext.inferenceContext()
.addFreeTypeListener(List.from(stuckVars), this);
}
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
public CheckStuckPolicy(ResultInfo resultInfo, DeferredType dt) {
this.pt = resultInfo.pt;
this.inferenceContext = resultInfo.checkContext.inferenceContext();
scan(dt.tree);
if (!stuckVars.isEmpty()) {
resultInfo.checkContext.inferenceContext()
.addFreeTypeListener(List.from(stuckVars), this);
}
}
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
/** Construct a list consisting of given elements.
*/
public static <A> List<A> of(A x1, A x2, A x3, A... rest) {
return new List<A>(x1, new List<A>(x2, new List<A>(x3, from(rest))));
}
代码示例来源:origin: sc.fiji/javac
/** Construct a list consisting of given elements.
*/
public static <A> List<A> of(A x1, A x2, A x3, A... rest) {
return new List<A>(x1, new List<A>(x2, new List<A>(x3, from(rest))));
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
/** Construct a list consisting of given elements.
*/
@SuppressWarnings({"varargs", "unchecked"})
public static <A> List<A> of(A x1, A x2, A x3, A... rest) {
return new List<A>(x1, new List<A>(x2, new List<A>(x3, from(rest))));
}
代码示例来源:origin: konsoletyper/teavm-javac
/** Construct a list consisting of given elements.
*/
@SuppressWarnings({"varargs", "unchecked"})
public static <A> List<A> of(A x1, A x2, A x3, A... rest) {
return new List<A>(x1, new List<A>(x2, new List<A>(x3, from(rest))));
}
内容来源于网络,如有侵权,请联系作者删除!