/** * 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(); }
/** 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"); } }
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());
result.add(key.method.returnType().inline(inliner)); return List.from(result);
/** * 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); }
public List<Attribute> getValue() { return List.from(values); } public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
public List<Attribute> getValue() { return List.from(values); } public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
public List<Attribute> getValue() { return List.from(values); } public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
public List<Attribute> getValue() { return List.from(values); } public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
/** * 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 ) ); }
private void checkAccessibleTypes(final DiagnosticPosition pos, final Env<AttrContext> env, final InferenceContext inferenceContext, final Type... ts) { checkAccessibleTypes(pos, env, inferenceContext, List.from(ts)); }
/** * 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(); }
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); } }
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); } }
/** 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)))); }
/** 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)))); }
/** 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)))); }
/** 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)))); }