public abstract class BaseProcessor
extends javax.annotation.processing.AbstractProcessor
By default #process() will do the following:
#processEach() allows each element to be processed, even if exceptions are thrown. Due to the non-deterministic ordering of the processed elements, this is needed to ensure a consistent set of exceptions are thrown with each build.
| Constructor and Description |
|---|
BaseProcessor() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
claimAnnotations() |
protected boolean |
delayErrors() |
javax.lang.model.util.Elements |
getElementUtils() |
protected dagger.hilt.processor.internal.ProcessorErrorHandler |
getErrorHandler() |
javax.annotation.processing.Messager |
getMessager() |
javax.annotation.processing.ProcessingEnvironment |
getProcessingEnv() |
javax.lang.model.SourceVersion |
getSupportedSourceVersion() |
javax.lang.model.util.Types |
getTypeUtils() |
void |
init(javax.annotation.processing.ProcessingEnvironment processingEnvironment) |
protected void |
postRoundProcess(javax.annotation.processing.RoundEnvironment roundEnv)
Used to perform post processing at the end of a round.
|
protected void |
preRoundProcess(javax.annotation.processing.RoundEnvironment roundEnv)
Used to perform initialization before each round of processing.
|
boolean |
process(java.util.Set<? extends javax.lang.model.element.TypeElement> annotations,
javax.annotation.processing.RoundEnvironment roundEnv)
This should not be overridden, as it defines the order of the processing.
|
protected void |
processEach(javax.lang.model.element.TypeElement annotation,
javax.lang.model.element.Element element)
Called for each element in a round that uses a supported annotation.
|
protected void preRoundProcess(javax.annotation.processing.RoundEnvironment roundEnv)
protected void processEach(javax.lang.model.element.TypeElement annotation,
javax.lang.model.element.Element element)
throws java.lang.Exception
java.lang.Exceptionprotected void postRoundProcess(javax.annotation.processing.RoundEnvironment roundEnv)
throws java.lang.Exception
Note: this will not be called if an exception is thrown during #processEach() -- if we have already detected errors on an annotated element, performing post processing on an aggregate will just produce more (perhaps non-deterministic) errors.
java.lang.Exceptionprotected boolean claimAnnotations()
protected boolean delayErrors()
public void init(javax.annotation.processing.ProcessingEnvironment processingEnvironment)
init in interface javax.annotation.processing.Processorinit in class javax.annotation.processing.AbstractProcessorpublic javax.lang.model.SourceVersion getSupportedSourceVersion()
getSupportedSourceVersion in interface javax.annotation.processing.ProcessorgetSupportedSourceVersion in class javax.annotation.processing.AbstractProcessorpublic final boolean process(java.util.Set<? extends javax.lang.model.element.TypeElement> annotations,
javax.annotation.processing.RoundEnvironment roundEnv)
process in interface javax.annotation.processing.Processorprocess in class javax.annotation.processing.AbstractProcessorprotected final dagger.hilt.processor.internal.ProcessorErrorHandler getErrorHandler()
public final javax.annotation.processing.ProcessingEnvironment getProcessingEnv()
public final javax.lang.model.util.Elements getElementUtils()
public final javax.lang.model.util.Types getTypeUtils()
public final javax.annotation.processing.Messager getMessager()