langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
equal
deleted
inserted
replaced
581 protected final <T> Queue<T> stopIfError(CompileState cs, Queue<T> queue) { |
581 protected final <T> Queue<T> stopIfError(CompileState cs, Queue<T> queue) { |
582 return shouldStop(cs) ? new ListBuffer<T>() : queue; |
582 return shouldStop(cs) ? new ListBuffer<T>() : queue; |
583 } |
583 } |
584 |
584 |
585 protected final <T> List<T> stopIfError(CompileState cs, List<T> list) { |
585 protected final <T> List<T> stopIfError(CompileState cs, List<T> list) { |
586 return shouldStop(cs) ? List.<T>nil() : list; |
586 return shouldStop(cs) ? List.nil() : list; |
587 } |
587 } |
588 |
588 |
589 /** The number of warnings reported so far. |
589 /** The number of warnings reported so far. |
590 */ |
590 */ |
591 public int warningCount() { |
591 public int warningCount() { |
610 * @param filename The name of the file from which input stream comes. |
610 * @param filename The name of the file from which input stream comes. |
611 * @param content The characters to be parsed. |
611 * @param content The characters to be parsed. |
612 */ |
612 */ |
613 protected JCCompilationUnit parse(JavaFileObject filename, CharSequence content) { |
613 protected JCCompilationUnit parse(JavaFileObject filename, CharSequence content) { |
614 long msec = now(); |
614 long msec = now(); |
615 JCCompilationUnit tree = make.TopLevel(List.<JCTree>nil()); |
615 JCCompilationUnit tree = make.TopLevel(List.nil()); |
616 if (content != null) { |
616 if (content != null) { |
617 if (verbose) { |
617 if (verbose) { |
618 log.printVerbose("parsing.started", filename); |
618 log.printVerbose("parsing.started", filename); |
619 } |
619 } |
620 if (!taskListener.isEmpty()) { |
620 if (!taskListener.isEmpty()) { |
723 return syms.errSymbol; |
723 return syms.errSymbol; |
724 tree = (tree == null) ? make.Ident(names.fromString(s)) |
724 tree = (tree == null) ? make.Ident(names.fromString(s)) |
725 : make.Select(tree, names.fromString(s)); |
725 : make.Select(tree, names.fromString(s)); |
726 } |
726 } |
727 JCCompilationUnit toplevel = |
727 JCCompilationUnit toplevel = |
728 make.TopLevel(List.<JCTree>nil()); |
728 make.TopLevel(List.nil()); |
729 toplevel.modle = msym; |
729 toplevel.modle = msym; |
730 toplevel.packge = msym.unnamedPackage; |
730 toplevel.packge = msym.unnamedPackage; |
731 return attr.attribIdent(tree, toplevel); |
731 return attr.attribIdent(tree, toplevel); |
732 } finally { |
732 } finally { |
733 log.useSource(prev); |
733 log.useSource(prev); |
790 try { |
790 try { |
791 JCTree.JCCompilationUnit t = parse(filename, filename.getCharContent(false)); |
791 JCTree.JCCompilationUnit t = parse(filename, filename.getCharContent(false)); |
792 return t; |
792 return t; |
793 } catch (IOException e) { |
793 } catch (IOException e) { |
794 log.error("error.reading.file", filename, JavacFileManager.getMessage(e)); |
794 log.error("error.reading.file", filename, JavacFileManager.getMessage(e)); |
795 return make.TopLevel(List.<JCTree>nil()); |
795 return make.TopLevel(List.nil()); |
796 } finally { |
796 } finally { |
797 log.useSource(prev); |
797 log.useSource(prev); |
798 } |
798 } |
799 } |
799 } |
800 |
800 |
884 private long start_msec = 0; |
884 private long start_msec = 0; |
885 public long elapsed_msec = 0; |
885 public long elapsed_msec = 0; |
886 |
886 |
887 public void compile(List<JavaFileObject> sourceFileObject) |
887 public void compile(List<JavaFileObject> sourceFileObject) |
888 throws Throwable { |
888 throws Throwable { |
889 compile(sourceFileObject, List.<String>nil(), null); |
889 compile(sourceFileObject, List.nil(), null); |
890 } |
890 } |
891 |
891 |
892 /** |
892 /** |
893 * Main method: compile a list of files, return all compiled classes |
893 * Main method: compile a list of files, return all compiled classes |
894 * |
894 * |
1147 } |
1147 } |
1148 } |
1148 } |
1149 |
1149 |
1150 // TODO: called by JavacTaskImpl |
1150 // TODO: called by JavacTaskImpl |
1151 public void processAnnotations(List<JCCompilationUnit> roots) { |
1151 public void processAnnotations(List<JCCompilationUnit> roots) { |
1152 processAnnotations(roots, List.<String>nil()); |
1152 processAnnotations(roots, List.nil()); |
1153 } |
1153 } |
1154 |
1154 |
1155 /** |
1155 /** |
1156 * Process any annotations found in the specified compilation units. |
1156 * Process any annotations found in the specified compilation units. |
1157 * @param roots a list of compilation units |
1157 * @param roots a list of compilation units |