1 12 13 package org.eclipse.jdt.internal.compiler.apt.dispatch; 14 15 import java.io.PrintWriter ; 16 import java.util.ArrayList ; 17 import java.util.List ; 18 19 import org.eclipse.jdt.internal.compiler.AbstractAnnotationProcessorManager; 20 import org.eclipse.jdt.internal.compiler.Compiler; 21 import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; 22 import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; 23 import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; 24 25 39 public abstract class BaseAnnotationProcessorManager extends AbstractAnnotationProcessorManager 40 implements IProcessorProvider 41 { 42 43 protected PrintWriter _out; 44 protected PrintWriter _err; 45 protected BaseProcessingEnvImpl _processingEnv; 46 protected boolean _isFirstRound = true; 47 48 52 protected List <ProcessorInfo> _processors = new ArrayList <ProcessorInfo>(); 53 54 protected boolean _printProcessorInfo = false; 56 protected boolean _printRounds = false; 57 protected int _round; 58 59 62 @Override 63 public void configure(Object batchCompiler, String [] options) { 64 throw new UnsupportedOperationException (); 66 } 67 68 71 @Override 72 public void configureFromPlatform(Compiler compiler, Object compilationUnitLocator, Object javaProject) { 73 throw new UnsupportedOperationException (); 75 } 76 77 @Override 78 public List <ProcessorInfo> getDiscoveredProcessors() { 79 return _processors; 80 } 81 82 @Override 83 public ICompilationUnit[] getDeletedUnits() { 84 return _processingEnv.getDeletedUnits(); 85 } 86 87 @Override 88 public ICompilationUnit[] getNewUnits() { 89 return _processingEnv.getNewUnits(); 90 } 91 92 @Override 93 public ReferenceBinding[] getNewClassFiles() { 94 return _processingEnv.getNewClassFiles(); 95 } 96 97 @Override 98 public void reset() { 99 _processingEnv.reset(); 100 } 101 102 105 @Override 106 public void setErr(PrintWriter err) { 107 _err = err; 108 } 109 110 113 @Override 114 public void setOut(PrintWriter out) { 115 _out = out; 116 } 117 118 121 @Override 122 public void setProcessors(Object [] processors) { 123 throw new UnsupportedOperationException (); 125 } 126 127 146 @Override 147 public void processAnnotations(CompilationUnitDeclaration[] units, ReferenceBinding[] referenceBindings, boolean isLastRound) { 148 RoundEnvImpl roundEnv = new RoundEnvImpl(units, referenceBindings, isLastRound, _processingEnv); 149 if (_isFirstRound) { 150 _isFirstRound = false; 151 } 152 PrintWriter traceProcessorInfo = _printProcessorInfo ? _out : null; 153 PrintWriter traceRounds = _printRounds ? _out : null; 154 if (traceRounds != null) { 155 traceRounds.println("Round " + ++_round + ':'); } 157 RoundDispatcher dispatcher = new RoundDispatcher( 158 this, roundEnv, roundEnv.getRootAnnotations(), traceProcessorInfo, traceRounds); 159 dispatcher.round(); 160 } 161 162 } 163 | Popular Tags |