805 final Context context; |
805 final Context context; |
806 /** The compiler for the round. */ |
806 /** The compiler for the round. */ |
807 final JavaCompiler compiler; |
807 final JavaCompiler compiler; |
808 /** The log for the round. */ |
808 /** The log for the round. */ |
809 final Log log; |
809 final Log log; |
810 /** The number of warnings in the previous round. */ |
|
811 final int priorWarnings; |
|
812 |
810 |
813 /** The ASTs to be compiled. */ |
811 /** The ASTs to be compiled. */ |
814 List<JCCompilationUnit> roots; |
812 List<JCCompilationUnit> roots; |
815 /** The classes to be compiler that have were generated. */ |
813 /** The classes to be compiler that have were generated. */ |
816 Map<String, JavaFileObject> genClassFiles; |
814 Map<String, JavaFileObject> genClassFiles; |
824 |
822 |
825 /** Create a round (common code). */ |
823 /** Create a round (common code). */ |
826 private Round(Context context, int number, int priorWarnings) { |
824 private Round(Context context, int number, int priorWarnings) { |
827 this.context = context; |
825 this.context = context; |
828 this.number = number; |
826 this.number = number; |
829 this.priorWarnings = priorWarnings; |
|
830 |
827 |
831 compiler = JavaCompiler.instance(context); |
828 compiler = JavaCompiler.instance(context); |
832 log = Log.instance(context); |
829 log = Log.instance(context); |
|
830 log.nwarnings += priorWarnings; |
833 log.deferDiagnostics = true; |
831 log.deferDiagnostics = true; |
834 |
832 |
835 // the following is for the benefit of JavacProcessingEnvironment.getContext() |
833 // the following is for the benefit of JavacProcessingEnvironment.getContext() |
836 JavacProcessingEnvironment.this.context = context; |
834 JavacProcessingEnvironment.this.context = context; |
837 |
835 |
902 |
900 |
903 /** Create the compiler to be used for the final compilation. */ |
901 /** Create the compiler to be used for the final compilation. */ |
904 JavaCompiler finalCompiler(boolean errorStatus) { |
902 JavaCompiler finalCompiler(boolean errorStatus) { |
905 try { |
903 try { |
906 JavaCompiler c = JavaCompiler.instance(nextContext()); |
904 JavaCompiler c = JavaCompiler.instance(nextContext()); |
|
905 c.log.nwarnings += compiler.log.nwarnings; |
907 if (errorStatus) { |
906 if (errorStatus) { |
908 c.log.nwarnings += priorWarnings + compiler.log.nwarnings; |
|
909 c.log.nerrors += compiler.log.nerrors; |
907 c.log.nerrors += compiler.log.nerrors; |
910 } |
908 } |
911 return c; |
909 return c; |
912 } finally { |
910 } finally { |
913 compiler.close(false); |
911 compiler.close(false); |