Class BeanDefinitionInjectProcessor

  • All Implemented Interfaces:
    javax.annotation.processing.Processor

    @Internal
    @SupportedOptions({"micronaut.processing.incremental","micronaut.processing.annotations","micronaut.processing.omit.confprop.injectpoints"})
    public class BeanDefinitionInjectProcessor
    extends javax.annotation.processing.AbstractProcessor

    The core annotation processor used to generate bean definitions and power AOP for Micronaut.

    Each dependency injection candidate is visited and BeanDefinitionWriter is used to produce byte code via ASM. Each bean results in a instanceof BeanDefinition

    Since:
    1.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void error​(java.lang.String msg, java.lang.Object... args)
      Produce a compile error for the given message.
      protected void error​(javax.lang.model.element.Element e, java.lang.String msg, java.lang.Object... args)
      Produce a compile error for the given element and message.
      protected java.lang.String getIncrementalProcessorType()  
      java.util.Set<java.lang.String> getSupportedAnnotationTypes()  
      java.util.Set<java.lang.String> getSupportedOptions()  
      javax.lang.model.SourceVersion getSupportedSourceVersion()  
      protected io.micronaut.inject.visitor.TypeElementVisitor.VisitorKind getVisitorKind()
      obtains the visitor kind.
      void init​(javax.annotation.processing.ProcessingEnvironment processingEnv)  
      protected boolean isIncremental​(javax.annotation.processing.ProcessingEnvironment processingEnv)
      Whether incremental compilation is enabled.
      protected boolean isProcessedAnnotation​(java.lang.String annotationName)
      Return whether the given annotation is processed.
      protected JavaVisitorContext newVisitorContext​(javax.annotation.processing.ProcessingEnvironment processingEnv)
      Creates the visitor context.
      protected void note​(java.lang.String msg, java.lang.Object... args)
      Produce a compile note for the given element and message.
      protected void note​(javax.lang.model.element.Element e, java.lang.String msg, java.lang.Object... args)
      Produce a compile note for the given element and message.
      boolean process​(java.util.Set<? extends javax.lang.model.element.TypeElement> annotations, javax.annotation.processing.RoundEnvironment roundEnv)  
      protected void warning​(java.lang.String msg, java.lang.Object... args)
      Produce a compile warning for the given message.
      protected void warning​(javax.lang.model.element.Element e, java.lang.String msg, java.lang.Object... args)
      Produce a compile warning for the given element and message.
      • Methods inherited from class javax.annotation.processing.AbstractProcessor

        getCompletions, isInitialized
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MICRONAUT_PROCESSING_INCREMENTAL

        protected static final java.lang.String MICRONAUT_PROCESSING_INCREMENTAL
        Annotation processor option used to activate incremental processing.
        See Also:
        Constant Field Values
      • MICRONAUT_PROCESSING_ANNOTATIONS

        protected static final java.lang.String MICRONAUT_PROCESSING_ANNOTATIONS
        Annotation processor option used to add additional annotation patterns to process.
        See Also:
        Constant Field Values
      • GRADLE_PROCESSING_AGGREGATING

        protected static final java.lang.String GRADLE_PROCESSING_AGGREGATING
        Constant for aggregating processor.
        See Also:
        Constant Field Values
      • GRADLE_PROCESSING_ISOLATING

        protected static final java.lang.String GRADLE_PROCESSING_ISOLATING
        Constant for isolating processor.
        See Also:
        Constant Field Values
      • messager

        protected javax.annotation.processing.Messager messager
      • filer

        protected javax.annotation.processing.Filer filer
      • elementUtils

        protected javax.lang.model.util.Elements elementUtils
      • typeUtils

        protected javax.lang.model.util.Types typeUtils
      • visitorAttributes

        protected io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> visitorAttributes
    • Constructor Detail

      • BeanDefinitionInjectProcessor

        public BeanDefinitionInjectProcessor()
    • Method Detail

      • init

        public final void init​(javax.annotation.processing.ProcessingEnvironment processingEnv)
        Specified by:
        init in interface javax.annotation.processing.Processor
      • newVisitorContext

        @NonNull
        protected JavaVisitorContext newVisitorContext​(@NonNull
                                                       javax.annotation.processing.ProcessingEnvironment processingEnv)
        Creates the visitor context.
        Parameters:
        processingEnv - The processing env
        Returns:
        The context
      • process

        public final boolean process​(java.util.Set<? extends javax.lang.model.element.TypeElement> annotations,
                                     javax.annotation.processing.RoundEnvironment roundEnv)
        Specified by:
        process in interface javax.annotation.processing.Processor
        Specified by:
        process in class javax.annotation.processing.AbstractProcessor
      • getSupportedSourceVersion

        public javax.lang.model.SourceVersion getSupportedSourceVersion()
        Specified by:
        getSupportedSourceVersion in interface javax.annotation.processing.Processor
        Overrides:
        getSupportedSourceVersion in class javax.annotation.processing.AbstractProcessor
      • getSupportedOptions

        public java.util.Set<java.lang.String> getSupportedOptions()
        Specified by:
        getSupportedOptions in interface javax.annotation.processing.Processor
        Overrides:
        getSupportedOptions in class javax.annotation.processing.AbstractProcessor
      • getSupportedAnnotationTypes

        public java.util.Set<java.lang.String> getSupportedAnnotationTypes()
        Specified by:
        getSupportedAnnotationTypes in interface javax.annotation.processing.Processor
        Overrides:
        getSupportedAnnotationTypes in class javax.annotation.processing.AbstractProcessor
      • isProcessedAnnotation

        protected boolean isProcessedAnnotation​(java.lang.String annotationName)
        Return whether the given annotation is processed.
        Parameters:
        annotationName - The annotation name
        Returns:
        True if it is
      • getVisitorKind

        @NonNull
        protected io.micronaut.inject.visitor.TypeElementVisitor.VisitorKind getVisitorKind()
        obtains the visitor kind.
        Returns:
        The visitor kind
      • error

        protected final void error​(javax.lang.model.element.Element e,
                                   java.lang.String msg,
                                   java.lang.Object... args)
        Produce a compile error for the given element and message.
        Parameters:
        e - The element
        msg - The message
        args - The string format args
      • error

        protected final void error​(java.lang.String msg,
                                   java.lang.Object... args)
        Produce a compile error for the given message.
        Parameters:
        msg - The message
        args - The string format args
      • warning

        protected final void warning​(javax.lang.model.element.Element e,
                                     java.lang.String msg,
                                     java.lang.Object... args)
        Produce a compile warning for the given element and message.
        Parameters:
        e - The element
        msg - The message
        args - The string format args
      • warning

        protected final void warning​(java.lang.String msg,
                                     java.lang.Object... args)
        Produce a compile warning for the given message.
        Parameters:
        msg - The message
        args - The string format args
      • note

        protected final void note​(javax.lang.model.element.Element e,
                                  java.lang.String msg,
                                  java.lang.Object... args)
        Produce a compile note for the given element and message.
        Parameters:
        e - The element
        msg - The message
        args - The string format args
      • note

        protected final void note​(java.lang.String msg,
                                  java.lang.Object... args)
        Produce a compile note for the given element and message.
        Parameters:
        msg - The message
        args - The string format args
      • isIncremental

        protected boolean isIncremental​(@NonNull
                                        javax.annotation.processing.ProcessingEnvironment processingEnv)
        Whether incremental compilation is enabled.
        Parameters:
        processingEnv - The processing environment.
        Returns:
        True if it is