diff -r 71680973d8ec -r 7dbb79875a63 src/share/classes/com/sun/tools/javac/main/JavaCompiler.java --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Wed Aug 12 07:54:30 2009 -0700 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Wed Aug 12 10:34:13 2009 -0700 @@ -813,6 +813,9 @@ } catch (Abort ex) { if (devVerbose) ex.printStackTrace(); + } finally { + if (procEnvImpl != null) + procEnvImpl.close(); } } @@ -936,7 +939,7 @@ /** * Object to handle annotation processing. */ - JavacProcessingEnvironment procEnvImpl = null; + private JavacProcessingEnvironment procEnvImpl = null; /** * Check if we should process annotations. @@ -947,7 +950,8 @@ * @param processors user provided annotation processors to bypass * discovery, {@code null} means that no processors were provided */ - public void initProcessAnnotations(Iterable processors) { + public void initProcessAnnotations(Iterable processors) + throws IOException { // Process annotations if processing is not disabled and there // is at least one Processor available. Options options = Options.instance(context); @@ -974,7 +978,8 @@ } // TODO: called by JavacTaskImpl - public JavaCompiler processAnnotations(List roots) throws IOException { + public JavaCompiler processAnnotations(List roots) + throws IOException { return processAnnotations(roots, List.nil()); } @@ -1061,10 +1066,14 @@ return this; } } - JavaCompiler c = procEnvImpl.doProcessing(context, roots, classSymbols, pckSymbols); - if (c != this) - annotationProcessingOccurred = c.annotationProcessingOccurred = true; - return c; + try { + JavaCompiler c = procEnvImpl.doProcessing(context, roots, classSymbols, pckSymbols); + if (c != this) + annotationProcessingOccurred = c.annotationProcessingOccurred = true; + return c; + } finally { + procEnvImpl.close(); + } } catch (CompletionFailure ex) { log.error("cant.access", ex.sym, ex.getDetailValue()); return this;