Search in sources :

Example 86 with ListBuffer

use of com.sun.tools.javac.util.ListBuffer in project ceylon-compiler by ceylon.

the class JavacPathFileManager method list.

@Override
public Iterable<JavaFileObject> list(Location location, String packageName, Set<Kind> kinds, boolean recurse) throws IOException {
    // validatePackageName(packageName);
    nullCheck(packageName);
    nullCheck(kinds);
    Iterable<? extends Path> paths = getLocation(location);
    if (paths == null)
        return List.nil();
    ListBuffer<JavaFileObject> results = new ListBuffer<JavaFileObject>();
    for (Path path : paths) list(path, packageName, kinds, recurse, results);
    return results.toList();
}
Also used : Path(java.nio.file.Path) JavaFileObject(javax.tools.JavaFileObject) ListBuffer(com.sun.tools.javac.util.ListBuffer)

Example 87 with ListBuffer

use of com.sun.tools.javac.util.ListBuffer in project ceylon-compiler by ceylon.

the class JavacPathFileManager method getClassLoader.

@Override
public ClassLoader getClassLoader(Location location) {
    nullCheck(location);
    Iterable<? extends Path> path = getLocation(location);
    if (path == null)
        return null;
    ListBuffer<URL> lb = new ListBuffer<URL>();
    for (Path p : path) {
        try {
            lb.append(p.toUri().toURL());
        } catch (MalformedURLException e) {
            throw new AssertionError(e);
        }
    }
    return getClassLoader(lb.toArray(new URL[lb.size()]));
}
Also used : Path(java.nio.file.Path) MalformedURLException(java.net.MalformedURLException) ListBuffer(com.sun.tools.javac.util.ListBuffer) URL(java.net.URL)

Example 88 with ListBuffer

use of com.sun.tools.javac.util.ListBuffer in project ceylon-compiler by ceylon.

the class ExpressionTransformer method transformLet.

// this one trusts the expected type
private JCExpression transformLet(LetExpression op, Type expectedType) {
    ListBuffer<JCStatement> defs = new ListBuffer<JCStatement>();
    for (Tree.Statement stmt : op.getLetClause().getVariables()) {
        defs.addAll(statementGen().transformVariableOrDestructure(stmt));
    }
    Tree.Term term = op.getLetClause().getExpression().getTerm();
    BoxingStrategy boxingStrategy = CodegenUtil.getBoxingStrategy(term);
    JCExpression expr = transformExpression(term, boxingStrategy, expectedType);
    at(op);
    if (isAnything(op.getTypeModel()) && CodegenUtil.isUnBoxed(term)) {
        defs.add(make().Exec(expr));
        expr = makeNull();
    }
    return make().LetExpr(defs.toList(), expr);
}
Also used : JCExpression(com.sun.tools.javac.tree.JCTree.JCExpression) Term(com.redhat.ceylon.compiler.typechecker.tree.Tree.Term) ListBuffer(com.sun.tools.javac.util.ListBuffer) JCTree(com.sun.tools.javac.tree.JCTree) Tree(com.redhat.ceylon.compiler.typechecker.tree.Tree) JCStatement(com.sun.tools.javac.tree.JCTree.JCStatement)

Aggregations

ListBuffer (com.sun.tools.javac.util.ListBuffer)88 JCExpression (com.sun.tools.javac.tree.JCTree.JCExpression)54 JCStatement (com.sun.tools.javac.tree.JCTree.JCStatement)25 JCVariableDecl (com.sun.tools.javac.tree.JCTree.JCVariableDecl)25 JCTree (com.sun.tools.javac.tree.JCTree)22 JCTypeParameter (com.sun.tools.javac.tree.JCTree.JCTypeParameter)22 Name (com.sun.tools.javac.util.Name)19 JavacNode (lombok.javac.JavacNode)18 JCAnnotation (com.sun.tools.javac.tree.JCTree.JCAnnotation)17 JCBlock (com.sun.tools.javac.tree.JCTree.JCBlock)17 JavacTreeMaker (lombok.javac.JavacTreeMaker)17 JCMethodDecl (com.sun.tools.javac.tree.JCTree.JCMethodDecl)14 Type (com.redhat.ceylon.model.typechecker.model.Type)12 JCClassDecl (com.sun.tools.javac.tree.JCTree.JCClassDecl)12 JCModifiers (com.sun.tools.javac.tree.JCTree.JCModifiers)11 JCPrimitiveTypeTree (com.sun.tools.javac.tree.JCTree.JCPrimitiveTypeTree)8 List (com.sun.tools.javac.util.List)7 ArrayList (java.util.ArrayList)7 Tree (com.redhat.ceylon.compiler.typechecker.tree.Tree)6 ModelUtil.appliedType (com.redhat.ceylon.model.typechecker.model.ModelUtil.appliedType)6