src/share/classes/com/sun/tools/javac/main/JavaCompiler.java

changeset 504
6eca0895a644
parent 372
7dbb79875a63
child 507
dbcba45123cd
equal deleted inserted replaced
501:f25efdb55c99 504:6eca0895a644
547 return delegateCompiler.warningCount(); 547 return delegateCompiler.warningCount();
548 else 548 else
549 return log.nwarnings; 549 return log.nwarnings;
550 } 550 }
551 551
552 /** Whether or not any parse errors have occurred.
553 */
554 public boolean parseErrors() {
555 return parseErrors;
556 }
557
558 /** Try to open input stream with given name. 552 /** Try to open input stream with given name.
559 * Report an error if this fails. 553 * Report an error if this fails.
560 * @param filename The file name of the input stream to be opened. 554 * @param filename The file name of the input stream to be opened.
561 */ 555 */
562 public CharSequence readSource(JavaFileObject filename) { 556 public CharSequence readSource(JavaFileObject filename) {
586 taskListener.started(e); 580 taskListener.started(e);
587 } 581 }
588 int initialErrorCount = log.nerrors; 582 int initialErrorCount = log.nerrors;
589 Parser parser = parserFactory.newParser(content, keepComments(), genEndPos, lineDebugInfo); 583 Parser parser = parserFactory.newParser(content, keepComments(), genEndPos, lineDebugInfo);
590 tree = parser.parseCompilationUnit(); 584 tree = parser.parseCompilationUnit();
591 parseErrors |= (log.nerrors > initialErrorCount); 585 log.unrecoverableError |= (log.nerrors > initialErrorCount);
592 if (verbose) { 586 if (verbose) {
593 printVerbose("parsing.done", Long.toString(elapsed(msec))); 587 printVerbose("parsing.done", Long.toString(elapsed(msec)));
594 } 588 }
595 } 589 }
596 590
765 759
766 /** Track when the JavaCompiler has been used to compile something. */ 760 /** Track when the JavaCompiler has been used to compile something. */
767 private boolean hasBeenUsed = false; 761 private boolean hasBeenUsed = false;
768 private long start_msec = 0; 762 private long start_msec = 0;
769 public long elapsed_msec = 0; 763 public long elapsed_msec = 0;
770
771 /** Track whether any errors occurred while parsing source text. */
772 private boolean parseErrors = false;
773 764
774 public void compile(List<JavaFileObject> sourceFileObject) 765 public void compile(List<JavaFileObject> sourceFileObject)
775 throws Throwable { 766 throws Throwable {
776 compile(sourceFileObject, List.<String>nil(), null); 767 compile(sourceFileObject, List.<String>nil(), null);
777 } 768 }

mercurial