2828
2929public class Processor extends AbstractProcessor {
3030
31- private ProcessingContext processingContext ;
31+ private ProcessingContext context ;
3232
3333 private Elements elementUtils ;
3434
@@ -51,7 +51,7 @@ public SourceVersion getSupportedSourceVersion() {
5151 @ Override
5252 public synchronized void init (ProcessingEnvironment processingEnv ) {
5353 super .init (processingEnv );
54- this .processingContext = new ProcessingContext (processingEnv );
54+ this .context = new ProcessingContext (processingEnv );
5555 this .elementUtils = processingEnv .getElementUtils ();
5656 }
5757
@@ -97,40 +97,40 @@ private void writeBeanHelpers() {
9797 for (BeanReader beanReader : beanReaders ) {
9898 try {
9999 if (!beanReader .isWrittenToFile ()) {
100- SimpleBeanWriter writer = new SimpleBeanWriter (beanReader , processingContext );
100+ SimpleBeanWriter writer = new SimpleBeanWriter (beanReader , context );
101101 writer .write ();
102102 beanReader .setWrittenToFile ();
103103 }
104104 } catch (FilerException e ) {
105- processingContext .logWarn ("FilerException to write $di class " + beanReader .getBeanType () + " " + e .getMessage ());
105+ context .logWarn ("FilerException to write $di class " + beanReader .getBeanType () + " " + e .getMessage ());
106106
107107 } catch (IOException e ) {
108108 e .printStackTrace ();
109- processingContext .logError (beanReader .getBeanType (), "Failed to write $di class" );
109+ context .logError (beanReader .getBeanType (), "Failed to write $di class" );
110110 }
111111 }
112112 }
113113
114114 private void writeBeanFactory () {
115115
116- MetaDataOrdering ordering = new MetaDataOrdering (metaData .values (), processingContext );
116+ MetaDataOrdering ordering = new MetaDataOrdering (metaData .values (), context );
117117 int remaining = ordering .processQueue ();
118118 if (remaining > 0 ) {
119119 if (ordering .hasCircularDependencies ()) {
120120 ordering .errorOnCircularDependencies ();
121121 } else {
122- processingContext .logWarn ("there are " + remaining + " beans with unsatisfied dependencies (assuming external dependencies)" );
122+ context .logWarn ("there are " + remaining + " beans with unsatisfied dependencies (assuming external dependencies)" );
123123 ordering .warnOnDependencies ();
124124 }
125125 }
126126
127127 try {
128- SimpleFactoryWriter factoryWriter = new SimpleFactoryWriter (ordering , processingContext );
128+ SimpleFactoryWriter factoryWriter = new SimpleFactoryWriter (ordering , context );
129129 factoryWriter .write ();
130130 } catch (FilerException e ) {
131- processingContext .logWarn ("FilerException trying to write factory " + e .getMessage ());
131+ context .logWarn ("FilerException trying to write factory " + e .getMessage ());
132132 } catch (IOException e ) {
133- processingContext .logError ("Failed to write factory " + e .getMessage ());
133+ context .logError ("Failed to write factory " + e .getMessage ());
134134 }
135135 }
136136
@@ -140,12 +140,12 @@ private void writeBeanFactory() {
140140 private void readChangedBeans (Set <? extends Element > beans , boolean factory ) {
141141 for (Element element : beans ) {
142142 if (!(element instanceof TypeElement )) {
143- processingContext .logError ("unexpected type [" + element + "]" );
143+ context .logError ("unexpected type [" + element + "]" );
144144 } else {
145145 if (readBeans .add (element .toString ())) {
146146 readBeanMeta ((TypeElement ) element , factory );
147147 } else {
148- processingContext .logDebug ("skipping already processed bean " + element );
148+ context .logDebug ("skipping already processed bean " + element );
149149 }
150150 }
151151 }
@@ -157,7 +157,7 @@ private void readChangedBeans(Set<? extends Element> beans, boolean factory) {
157157 private void mergeMetaData () {
158158 for (BeanReader beanReader : beanReaders ) {
159159 if (beanReader .isRequestScoped ()) {
160- processingContext .logDebug ("skipping request scoped processed bean " + beanReader );
160+ context .logDebug ("skipping request scoped processed bean " + beanReader );
161161 } else {
162162 String metaKey = beanReader .getMetaKey ();
163163 MetaData metaData = this .metaData .get (metaKey );
@@ -194,10 +194,10 @@ private void updateMeta(MetaData metaData, BeanReader beanReader) {
194194 private void readBeanMeta (TypeElement typeElement , boolean factory ) {
195195
196196 if (typeElement .getKind () == ElementKind .ANNOTATION_TYPE ) {
197- processingContext .logDebug ("skipping annotation type " + typeElement );
197+ context .logDebug ("skipping annotation type " + typeElement );
198198 return ;
199199 }
200- BeanReader beanReader = new BeanReader (typeElement , processingContext );
200+ BeanReader beanReader = new BeanReader (typeElement , context );
201201 beanReader .read (factory );
202202 beanReaders .add (beanReader );
203203 }
@@ -207,7 +207,7 @@ private void readBeanMeta(TypeElement typeElement, boolean factory) {
207207 */
208208 private void readModule (RoundEnvironment roundEnv ) {
209209
210- String factory = processingContext .loadMetaInfServices ();
210+ String factory = context .loadMetaInfServices ();
211211 if (factory != null ) {
212212 TypeElement factoryType = elementUtils .getTypeElement (factory );
213213 if (factoryType != null ) {
@@ -222,7 +222,7 @@ private void readModule(RoundEnvironment roundEnv) {
222222 Element element = iterator .next ();
223223 ContextModule annotation = element .getAnnotation (ContextModule .class );
224224 if (annotation != null ) {
225- processingContext .setContextDetails (annotation .name (), annotation .provides (), annotation .dependsOn (), element );
225+ context .setContextDetails (annotation .name (), annotation .provides (), annotation .dependsOn (), element );
226226 }
227227 }
228228 }
@@ -236,7 +236,7 @@ private void readModule(RoundEnvironment roundEnv) {
236236 private void readFactory (TypeElement factoryType ) {
237237
238238 ContextModule module = factoryType .getAnnotation (ContextModule .class );
239- processingContext .setContextDetails (module .name (), module .provides (), module .dependsOn (), factoryType );
239+ context .setContextDetails (module .name (), module .provides (), module .dependsOn (), factoryType );
240240
241241 List <? extends Element > elements = factoryType .getEnclosedElements ();
242242 if (elements != null ) {
@@ -249,7 +249,7 @@ private void readFactory(TypeElement factoryType) {
249249 // read a build method - DependencyMeta
250250 DependencyMeta meta = element .getAnnotation (DependencyMeta .class );
251251 if (meta == null ) {
252- processingContext .logError ("Missing @DependencyMeta on method " + simpleName .toString ());
252+ context .logError ("Missing @DependencyMeta on method " + simpleName .toString ());
253253 } else {
254254 final MetaData metaData = new MetaData (meta );
255255 this .metaData .put (metaData .getKey (), metaData );
0 commit comments