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

changeset 372
7dbb79875a63
parent 359
8227961c64d3
child 504
6eca0895a644
     1.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Wed Aug 12 07:54:30 2009 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Wed Aug 12 10:34:13 2009 -0700
     1.3 @@ -813,6 +813,9 @@
     1.4          } catch (Abort ex) {
     1.5              if (devVerbose)
     1.6                  ex.printStackTrace();
     1.7 +        } finally {
     1.8 +            if (procEnvImpl != null)
     1.9 +                procEnvImpl.close();
    1.10          }
    1.11      }
    1.12  
    1.13 @@ -936,7 +939,7 @@
    1.14      /**
    1.15       * Object to handle annotation processing.
    1.16       */
    1.17 -    JavacProcessingEnvironment procEnvImpl = null;
    1.18 +    private JavacProcessingEnvironment procEnvImpl = null;
    1.19  
    1.20      /**
    1.21       * Check if we should process annotations.
    1.22 @@ -947,7 +950,8 @@
    1.23       * @param processors user provided annotation processors to bypass
    1.24       * discovery, {@code null} means that no processors were provided
    1.25       */
    1.26 -    public void initProcessAnnotations(Iterable<? extends Processor> processors) {
    1.27 +    public void initProcessAnnotations(Iterable<? extends Processor> processors)
    1.28 +                throws IOException {
    1.29          // Process annotations if processing is not disabled and there
    1.30          // is at least one Processor available.
    1.31          Options options = Options.instance(context);
    1.32 @@ -974,7 +978,8 @@
    1.33      }
    1.34  
    1.35      // TODO: called by JavacTaskImpl
    1.36 -    public JavaCompiler processAnnotations(List<JCCompilationUnit> roots) throws IOException {
    1.37 +    public JavaCompiler processAnnotations(List<JCCompilationUnit> roots)
    1.38 +            throws IOException {
    1.39          return processAnnotations(roots, List.<String>nil());
    1.40      }
    1.41  
    1.42 @@ -1061,10 +1066,14 @@
    1.43                          return this;
    1.44                  }
    1.45              }
    1.46 -            JavaCompiler c = procEnvImpl.doProcessing(context, roots, classSymbols, pckSymbols);
    1.47 -            if (c != this)
    1.48 -                annotationProcessingOccurred = c.annotationProcessingOccurred = true;
    1.49 -            return c;
    1.50 +            try {
    1.51 +                JavaCompiler c = procEnvImpl.doProcessing(context, roots, classSymbols, pckSymbols);
    1.52 +                if (c != this)
    1.53 +                    annotationProcessingOccurred = c.annotationProcessingOccurred = true;
    1.54 +                return c;
    1.55 +            } finally {
    1.56 +                procEnvImpl.close();
    1.57 +            }
    1.58          } catch (CompletionFailure ex) {
    1.59              log.error("cant.access", ex.sym, ex.getDetailValue());
    1.60              return this;

mercurial