Class PythonAnnotationProcessor
java.lang.Object
javax.annotation.processing.AbstractProcessor
io.micronaut.annotation.processing.AbstractInjectAnnotationProcessor
io.micronaut.python.processing.PythonAnnotationProcessor
- All Implemented Interfaces:
AutoCloseable, Processor
@SupportedAnnotationTypes("io.micronaut.context.python.annotation.PythonApplication")
public class PythonAnnotationProcessor
extends AbstractInjectAnnotationProcessor
implements AutoCloseable
Annotation processor for
io.micronaut.context.python.annotation.PythonApplication that enables Python AST processing
during Java compilation.- Since:
- 5.2.0
- Author:
- Micronaut
-
Field Summary
FieldsFields inherited from class AbstractInjectAnnotationProcessor
classWriterOutputVisitor, elementUtils, filer, GRADLE_PROCESSING_AGGREGATING, GRADLE_PROCESSING_ISOLATING, javaVisitorContext, messager, MICRONAUT_PROCESSING_ANNOTATIONS, MICRONAUT_PROCESSING_INCREMENTAL, modelUtils, postponedTypes, typeUtils, visitorAttributesFields inherited from class AbstractProcessor
processingEnv -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidinit(ProcessingEnvironment processingEnv) booleanprocess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) voidsetClassElementCallback(Consumer<ClassElement> callback) Set the callback to be invoked for each class element created during processing.voidsetClassLoader(ClassLoader classLoader) Sets the class loader used for in-memory compiler execution.voidsetCompilePythonBytecode(boolean compilePythonBytecode) Set whether generated Python VFS resources should include optional GraalPy bytecode caches.voidsetIncrementalSources(Set<String> incrementalSources) Restricts isolating visitors and bean generation to affected Python sources.voidsetOutputDirectory(Path outputDirectory) Sets the class output directory used to reuse unchanged generated Python resources.voidsetProcessAggregatingVisitors(boolean processAggregatingVisitors) Sets whether aggregating Python type visitors should run.voidsetProcessingSession(PythonProcessingSession processingSession) Sets a session that owns the GraalPy context across compiler invocations.voidsetPythonSourceVisitors(List<PythonSourceVisitor> pythonSourceVisitors) Sets visitors for Python source metadata in this compilation.Methods inherited from class AbstractInjectAnnotationProcessor
error, error, getIncrementalProcessorType, getSupportedAnnotationTypes, getSupportedOptions, getSupportedSourceVersion, getVisitorKind, isIncremental, isProcessedAnnotation, newVisitorContext, note, note, processingGeneratedAnnotation, warning, warningMethods inherited from class AbstractProcessor
getCompletions, isInitialized
-
Field Details
-
APPLICATION_PATH
- See Also:
-
APPLICATION_SRC_PATH
- See Also:
-
APPLICATION_LAUNCHER_PATH
- See Also:
-
-
Constructor Details
-
PythonAnnotationProcessor
public PythonAnnotationProcessor()
-
-
Method Details
-
setClassElementCallback
Set the callback to be invoked for each class element created during processing. This is primarily used for testing purposes.- Parameters:
callback- The callback function
-
setPythonSourceVisitors
Sets visitors for Python source metadata in this compilation.- Parameters:
pythonSourceVisitors- the visitors
-
setCompilePythonBytecode
public void setCompilePythonBytecode(boolean compilePythonBytecode) Set whether generated Python VFS resources should include optional GraalPy bytecode caches. Application sources that require runtime compatibility transformations may include a cache regardless of this setting so that the original source remains available for debugging.- Parameters:
compilePythonBytecode- Whether optional bytecode caches should be emitted- Since:
- 5.2.0
-
setIncrementalSources
-
setProcessAggregatingVisitors
Sets whether aggregating Python type visitors should run.- Parameters:
processAggregatingVisitors- Whether aggregating visitors should run
-
setOutputDirectory
-
setProcessingSession
Sets a session that owns the GraalPy context across compiler invocations.- Parameters:
processingSession- The reusable processing session
-
init
- Specified by:
initin interfaceProcessor- Overrides:
initin classAbstractInjectAnnotationProcessor
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
process
- Specified by:
processin interfaceProcessor- Specified by:
processin classAbstractProcessor
-
setClassLoader
Sets the class loader used for in-memory compiler execution.- Parameters:
classLoader- The class loader
-