src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java

changeset 1521
71f35e4b93a5
parent 1442
fcf89720ae71
child 1690
76537856a54e
     1.1 --- a/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Wed Jan 23 20:57:40 2013 +0000
     1.2 +++ b/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Wed Jan 23 13:27:24 2013 -0800
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -817,9 +817,6 @@
    1.11          /** The set of package-info files to be processed this round. */
    1.12          List<PackageSymbol> packageInfoFiles;
    1.13  
    1.14 -        /** The number of Messager errors generated in this round. */
    1.15 -        int nMessagerErrors;
    1.16 -
    1.17          /** Create a round (common code). */
    1.18          private Round(Context context, int number, int priorErrors, int priorWarnings,
    1.19                  Log.DeferredDiagnosticHandler deferredDiagnosticHandler) {
    1.20 @@ -829,7 +826,7 @@
    1.21              compiler = JavaCompiler.instance(context);
    1.22              log = Log.instance(context);
    1.23              log.nerrors = priorErrors;
    1.24 -            log.nwarnings += priorWarnings;
    1.25 +            log.nwarnings = priorWarnings;
    1.26              if (number == 1) {
    1.27                  Assert.checkNonNull(deferredDiagnosticHandler);
    1.28                  this.deferredDiagnosticHandler = deferredDiagnosticHandler;
    1.29 @@ -870,7 +867,7 @@
    1.30                  Set<JavaFileObject> newSourceFiles, Map<String,JavaFileObject> newClassFiles) {
    1.31              this(prev.nextContext(),
    1.32                      prev.number+1,
    1.33 -                    prev.nMessagerErrors,
    1.34 +                    prev.compiler.log.nerrors,
    1.35                      prev.compiler.log.nwarnings,
    1.36                      null);
    1.37              this.genClassFiles = prev.genClassFiles;
    1.38 @@ -911,15 +908,12 @@
    1.39          }
    1.40  
    1.41          /** Create the compiler to be used for the final compilation. */
    1.42 -        JavaCompiler finalCompiler(boolean errorStatus) {
    1.43 +        JavaCompiler finalCompiler() {
    1.44              try {
    1.45                  Context nextCtx = nextContext();
    1.46                  JavacProcessingEnvironment.this.context = nextCtx;
    1.47                  JavaCompiler c = JavaCompiler.instance(nextCtx);
    1.48 -                c.log.nwarnings += compiler.log.nwarnings;
    1.49 -                if (errorStatus) {
    1.50 -                    c.log.nerrors += compiler.log.nerrors;
    1.51 -                }
    1.52 +                c.log.initRound(compiler.log);
    1.53                  return c;
    1.54              } finally {
    1.55                  compiler.close(false);
    1.56 @@ -1027,8 +1021,6 @@
    1.57                  if (!taskListener.isEmpty())
    1.58                      taskListener.finished(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING_ROUND));
    1.59              }
    1.60 -
    1.61 -            nMessagerErrors = messager.errorCount();
    1.62          }
    1.63  
    1.64          void showDiagnostics(boolean showAll) {
    1.65 @@ -1107,9 +1099,7 @@
    1.66              next.put(Tokens.tokensKey, tokens);
    1.67  
    1.68              Log nextLog = Log.instance(next);
    1.69 -            // propogate the log's writers directly, instead of going through context
    1.70 -            nextLog.setWriters(log);
    1.71 -            nextLog.setSourceMap(log);
    1.72 +            nextLog.initRound(log);
    1.73  
    1.74              JavaCompiler oldCompiler = JavaCompiler.instance(context);
    1.75              JavaCompiler nextCompiler = JavaCompiler.instance(next);
    1.76 @@ -1206,7 +1196,7 @@
    1.77                  new LinkedHashSet<JavaFileObject>(filer.getGeneratedSourceFileObjects());
    1.78          roots = cleanTrees(round.roots);
    1.79  
    1.80 -        JavaCompiler compiler = round.finalCompiler(errorStatus);
    1.81 +        JavaCompiler compiler = round.finalCompiler();
    1.82  
    1.83          if (newSourceFiles.size() > 0)
    1.84              roots = roots.appendList(compiler.parseFiles(newSourceFiles));
    1.85 @@ -1311,7 +1301,6 @@
    1.86          if (procNames != null)
    1.87              return true;
    1.88  
    1.89 -        String procPath;
    1.90          URL[] urls = new URL[1];
    1.91          for(File pathElement : workingpath) {
    1.92              try {
    1.93 @@ -1382,6 +1371,10 @@
    1.94                  node.sym = null;
    1.95                  super.visitIdent(node);
    1.96              }
    1.97 +            public void visitAnnotation(JCAnnotation node) {
    1.98 +                node.attribute = null;
    1.99 +                super.visitAnnotation(node);
   1.100 +            }
   1.101          };
   1.102  
   1.103  

mercurial