Package com.sun.tools.javac.tree.JCTree

Examples of com.sun.tools.javac.tree.JCTree.JCCompilationUnit


        if (r.errors > 0)
            throw new ParseException(sw.toString());
        Iterator<? extends CompilationUnitTree> iter = trees.iterator();
        if (!iter.hasNext())
            throw new Error("no trees found");
        JCCompilationUnit t = (JCCompilationUnit) iter.next();
        if (iter.hasNext())
            throw new Error("too many trees found");
        return t;
    }
View Full Code Here


            Iterable<? extends CompilationUnitTree> trees = task.parse();
            task.analyze();
            List<Pair<JCCompilationUnit, JCTree>> res = new ArrayList<>();
            //System.out.println("Try to add pairs. Elems are " + analyzedElems);
            for (CompilationUnitTree t : trees) {
               JCCompilationUnit cu = (JCCompilationUnit)t;
               for (JCTree def : cu.defs) {
                   if (def.getTag() == JCTree.CLASSDEF &&
                           analyzedElems.contains(((JCTree.JCClassDecl)def).sym)) {
                       //System.out.println("Adding pair...");
                       res.add(new Pair<>(cu, def));
View Full Code Here

            throw e;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        JCCompilationUnit result = make.TopLevel(List.<JCAnnotation> nil(), null, List.<JCTree> of(make.Erroneous()));
        result.sourcefile = filename;
        return result;
    }
View Full Code Here

                    }
                    // now return it
                    return phasedUnit.getPackage().getModule();
                }
            }
            JCCompilationUnit javaCompilationUnit = parse(fileObject);
            Module module;
            if(javaCompilationUnit instanceof CeylonCompilationUnit){
                CeylonCompilationUnit ceylonCompilationUnit = (CeylonCompilationUnit) javaCompilationUnit;
                moduleTrees.add(ceylonCompilationUnit);
                // parse the module info from there
View Full Code Here

   
    JavaCompiler compiler = new JavaCompiler(context);
    compiler.genEndPos = true;
    compiler.keepComments = true;
   
    @SuppressWarnings("deprecation") JCCompilationUnit cu = compiler.parse(args[0]);
    JcTreePrinter printer = new JcTreePrinter(true);
    printer.visit(cu);
    System.out.println(printer);
  }
View Full Code Here

    Options.instance(context).put(OptionName.ENCODING, "UTF-8");
   
    CommentCatcher catcher = CommentCatcher.create(context);
    JavaCompiler compiler = catcher.getCompiler();
   
    JCCompilationUnit cu = compiler.parse(new ContentBasedJavaFileObject(source.getName(), source.getRawInput()));
    JcTreeConverter converter = new JcTreeConverter();
    converter.visit(cu);
    return converter.getResultWithJavadoc(catcher.getComments(cu));
  }
View Full Code Here

   
    JavaCompiler compiler = new JavaCompiler(context);
    compiler.genEndPos = true;
    compiler.keepComments = true;
   
    JCCompilationUnit cu = compiler.parse(new ContentBasedJavaFileObject(source.getName(), source.getRawInput()));
    JcTreeConverter converter = new JcTreeConverter();
    JcTreeBuilder builder = new JcTreeBuilder();
    converter.visit(cu);
    builder.visit(converter.getResult());
    return builder.get();
View Full Code Here

   
    JavaCompiler compiler = new JavaCompiler(context);
    compiler.genEndPos = true;
    compiler.keepComments = true;
   
    JCCompilationUnit cu = compiler.parse(new ContentBasedJavaFileObject(source.getName(), source.getRawInput()));
    return cu;
  }
View Full Code Here

TOP

Related Classes of com.sun.tools.javac.tree.JCTree.JCCompilationUnit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.