< prev index next >

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

Print this page

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

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

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

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

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