1.1 --- a/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Tue Sep 25 13:06:58 2012 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Tue Sep 25 13:11:05 2012 -0700 1.3 @@ -97,11 +97,9 @@ 1.4 private final boolean printRounds; 1.5 private final boolean verbose; 1.6 private final boolean lint; 1.7 - private final boolean procOnly; 1.8 private final boolean fatalErrors; 1.9 private final boolean werror; 1.10 private final boolean showResolveErrors; 1.11 - private boolean foundTypeProcessors; 1.12 1.13 private final JavacFiler filer; 1.14 private final JavacMessager messager; 1.15 @@ -167,12 +165,14 @@ 1.16 printRounds = options.isSet(XPRINTROUNDS); 1.17 verbose = options.isSet(VERBOSE); 1.18 lint = Lint.instance(context).isEnabled(PROCESSING); 1.19 - procOnly = options.isSet(PROC, "only") || options.isSet(XPRINT); 1.20 + if (options.isSet(PROC, "only") || options.isSet(XPRINT)) { 1.21 + JavaCompiler compiler = JavaCompiler.instance(context); 1.22 + compiler.shouldStopPolicyIfNoError = CompileState.PROCESS; 1.23 + } 1.24 fatalErrors = options.isSet("fatalEnterError"); 1.25 showResolveErrors = options.isSet("showResolveErrors"); 1.26 werror = options.isSet(WERROR); 1.27 platformAnnotations = initPlatformAnnotations(); 1.28 - foundTypeProcessors = false; 1.29 1.30 // Initialize services before any processors are initialized 1.31 // in case processors use them. 1.32 @@ -462,7 +462,7 @@ 1.33 * State about how a processor has been used by the tool. If a 1.34 * processor has been used on a prior round, its process method is 1.35 * called on all subsequent rounds, perhaps with an empty set of 1.36 - * annotations to process. The {@code annotatedSupported} method 1.37 + * annotations to process. The {@code annotationSupported} method 1.38 * caches the supported annotation information from the first (and 1.39 * only) getSupportedAnnotationTypes call to the processor. 1.40 */ 1.41 @@ -882,7 +882,9 @@ 1.42 /** Create the compiler to be used for the final compilation. */ 1.43 JavaCompiler finalCompiler(boolean errorStatus) { 1.44 try { 1.45 - JavaCompiler c = JavaCompiler.instance(nextContext()); 1.46 + Context nextCtx = nextContext(); 1.47 + JavacProcessingEnvironment.this.context = nextCtx; 1.48 + JavaCompiler c = JavaCompiler.instance(nextCtx); 1.49 c.log.nwarnings += compiler.log.nwarnings; 1.50 if (errorStatus) { 1.51 c.log.nerrors += compiler.log.nerrors; 1.52 @@ -1021,7 +1023,7 @@ 1.53 } 1.54 1.55 /** Get the context for the next round of processing. 1.56 - * Important values are propogated from round to round; 1.57 + * Important values are propagated from round to round; 1.58 * other values are implicitly reset. 1.59 */ 1.60 private Context nextContext() { 1.61 @@ -1190,14 +1192,7 @@ 1.62 return compiler; 1.63 } 1.64 1.65 - if (procOnly && !foundTypeProcessors) { 1.66 - compiler.todo.clear(); 1.67 - } else { 1.68 - if (procOnly && foundTypeProcessors) 1.69 - compiler.shouldStopPolicy = CompileState.FLOW; 1.70 - 1.71 - compiler.enterTrees(roots); 1.72 - } 1.73 + compiler.enterTreesIfNeeded(roots); 1.74 1.75 return compiler; 1.76 }