< prev index next >

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

Print this page

  41 
  42 import javax.annotation.processing.*;
  43 import javax.lang.model.SourceVersion;
  44 import javax.lang.model.element.*;
  45 import javax.lang.model.util.*;
  46 import javax.tools.JavaFileManager;
  47 import javax.tools.JavaFileObject;
  48 import javax.tools.JavaFileObject.Kind;
  49 import javax.tools.StandardJavaFileManager;
  50 
  51 import static javax.tools.StandardLocation.*;
  52 
  53 import com.sun.source.util.TaskEvent;
  54 import com.sun.tools.javac.api.MultiTaskListener;
  55 import com.sun.tools.javac.code.*;
  56 import com.sun.tools.javac.code.DeferredCompletionFailureHandler.Handler;
  57 import com.sun.tools.javac.code.Scope.WriteableScope;
  58 import com.sun.tools.javac.code.Source.Feature;
  59 import com.sun.tools.javac.code.Symbol.*;
  60 import com.sun.tools.javac.code.Type.ClassType;

  61 import com.sun.tools.javac.code.Types;
  62 import com.sun.tools.javac.comp.AttrContext;
  63 import com.sun.tools.javac.comp.Check;
  64 import com.sun.tools.javac.comp.Enter;
  65 import com.sun.tools.javac.comp.Env;
  66 import com.sun.tools.javac.comp.Modules;
  67 import com.sun.tools.javac.file.JavacFileManager;
  68 import com.sun.tools.javac.main.JavaCompiler;
  69 import com.sun.tools.javac.main.Option;
  70 import com.sun.tools.javac.model.JavacElements;
  71 import com.sun.tools.javac.model.JavacTypes;
  72 import com.sun.tools.javac.platform.PlatformDescription;
  73 import com.sun.tools.javac.platform.PlatformDescription.PluginInfo;
  74 import com.sun.tools.javac.resources.CompilerProperties.Errors;
  75 import com.sun.tools.javac.resources.CompilerProperties.Warnings;
  76 import com.sun.tools.javac.tree.*;
  77 import com.sun.tools.javac.tree.JCTree.*;
  78 import com.sun.tools.javac.util.Abort;
  79 import com.sun.tools.javac.util.Assert;
  80 import com.sun.tools.javac.util.ClientCodeException;

1325             modules.newRound();
1326             types.newRound();
1327             annotate.newRound();
1328             elementUtils.newRound();
1329 
1330             boolean foundError = false;
1331 
1332             for (ClassSymbol cs : symtab.getAllClasses()) {
1333                 if (cs.kind == ERR) {
1334                     foundError = true;
1335                     break;
1336                 }
1337             }
1338 
1339             if (foundError) {
1340                 for (ClassSymbol cs : symtab.getAllClasses()) {
1341                     if (cs.classfile != null || cs.kind == ERR) {
1342                         Kinds.Kind symKind = cs.kind;
1343                         cs.reset();
1344                         if (symKind == ERR) {
1345                             cs.type = new ClassType(cs.type.getEnclosingType(), null, cs);
1346                         }
1347                         if (cs.isCompleted()) {
1348                             cs.completer = initialCompleter;
1349                         }
1350                     }
1351                 }
1352             }
1353         }
1354     }
1355 
1356 
1357     // TODO: internal catch clauses?; catch and rethrow an annotation
1358     // processing error
1359     public boolean doProcessing(List<JCCompilationUnit> roots,
1360                                 List<ClassSymbol> classSymbols,
1361                                 Iterable<? extends PackageSymbol> pckSymbols,
1362                                 Log.DeferredDiagnosticHandler deferredDiagnosticHandler) {
1363         final Set<JCCompilationUnit> treesToClean =
1364                 Collections.newSetFromMap(new IdentityHashMap<JCCompilationUnit, Boolean>());
1365 

  41 
  42 import javax.annotation.processing.*;
  43 import javax.lang.model.SourceVersion;
  44 import javax.lang.model.element.*;
  45 import javax.lang.model.util.*;
  46 import javax.tools.JavaFileManager;
  47 import javax.tools.JavaFileObject;
  48 import javax.tools.JavaFileObject.Kind;
  49 import javax.tools.StandardJavaFileManager;
  50 
  51 import static javax.tools.StandardLocation.*;
  52 
  53 import com.sun.source.util.TaskEvent;
  54 import com.sun.tools.javac.api.MultiTaskListener;
  55 import com.sun.tools.javac.code.*;
  56 import com.sun.tools.javac.code.DeferredCompletionFailureHandler.Handler;
  57 import com.sun.tools.javac.code.Scope.WriteableScope;
  58 import com.sun.tools.javac.code.Source.Feature;
  59 import com.sun.tools.javac.code.Symbol.*;
  60 import com.sun.tools.javac.code.Type.ClassType;
  61 import com.sun.tools.javac.code.Type.ClassType.Flavor;
  62 import com.sun.tools.javac.code.Types;
  63 import com.sun.tools.javac.comp.AttrContext;
  64 import com.sun.tools.javac.comp.Check;
  65 import com.sun.tools.javac.comp.Enter;
  66 import com.sun.tools.javac.comp.Env;
  67 import com.sun.tools.javac.comp.Modules;
  68 import com.sun.tools.javac.file.JavacFileManager;
  69 import com.sun.tools.javac.main.JavaCompiler;
  70 import com.sun.tools.javac.main.Option;
  71 import com.sun.tools.javac.model.JavacElements;
  72 import com.sun.tools.javac.model.JavacTypes;
  73 import com.sun.tools.javac.platform.PlatformDescription;
  74 import com.sun.tools.javac.platform.PlatformDescription.PluginInfo;
  75 import com.sun.tools.javac.resources.CompilerProperties.Errors;
  76 import com.sun.tools.javac.resources.CompilerProperties.Warnings;
  77 import com.sun.tools.javac.tree.*;
  78 import com.sun.tools.javac.tree.JCTree.*;
  79 import com.sun.tools.javac.util.Abort;
  80 import com.sun.tools.javac.util.Assert;
  81 import com.sun.tools.javac.util.ClientCodeException;

1326             modules.newRound();
1327             types.newRound();
1328             annotate.newRound();
1329             elementUtils.newRound();
1330 
1331             boolean foundError = false;
1332 
1333             for (ClassSymbol cs : symtab.getAllClasses()) {
1334                 if (cs.kind == ERR) {
1335                     foundError = true;
1336                     break;
1337                 }
1338             }
1339 
1340             if (foundError) {
1341                 for (ClassSymbol cs : symtab.getAllClasses()) {
1342                     if (cs.classfile != null || cs.kind == ERR) {
1343                         Kinds.Kind symKind = cs.kind;
1344                         cs.reset();
1345                         if (symKind == ERR) {
1346                             cs.type = new ClassType(cs.type.getEnclosingType(), null, cs, TypeMetadata.EMPTY, Flavor.X_Typeof_X);
1347                         }
1348                         if (cs.isCompleted()) {
1349                             cs.completer = initialCompleter;
1350                         }
1351                     }
1352                 }
1353             }
1354         }
1355     }
1356 
1357 
1358     // TODO: internal catch clauses?; catch and rethrow an annotation
1359     // processing error
1360     public boolean doProcessing(List<JCCompilationUnit> roots,
1361                                 List<ClassSymbol> classSymbols,
1362                                 Iterable<? extends PackageSymbol> pckSymbols,
1363                                 Log.DeferredDiagnosticHandler deferredDiagnosticHandler) {
1364         final Set<JCCompilationUnit> treesToClean =
1365                 Collections.newSetFromMap(new IdentityHashMap<JCCompilationUnit, Boolean>());
1366 
< prev index next >