Package org.antlr.v4.test.runtime
Class CommentHasStringValueProcessor
java.lang.Object
javax.annotation.processing.AbstractProcessor
org.antlr.v4.test.runtime.CommentHasStringValueProcessor
- All Implemented Interfaces:
Processor
@SupportedAnnotationTypes("org.antlr.v4.test.runtime.CommentHasStringValue")
@SupportedSourceVersion(RELEASE_7)
public class CommentHasStringValueProcessor
extends AbstractProcessor
I think I figured out how to use annotation processors in maven. It's
more or less automatic and you don't even need to tell maven, with one minor
exception. The idea is to create a project for the annotation and another
for the annotation processor. Then, a project that uses the annotation
can simply set up the dependency on the other projects. You have to turn
off processing, -proc:none on the processor project itself but other than
that, java 6+ more or less tries to apply any processors it finds during
compilation. maven just works.
Also you need a META-INF/services/javax.annotation.processing.Processor file
with "org.antlr.v4.test.runtime.CommentHasStringValueProcessor" in it.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.sun.tools.javac.tree.TreeMakerprotected com.sun.tools.javac.model.JavacElementsFields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static com.sun.tools.javac.util.ContextextractContext(com.sun.tools.javac.model.JavacElements utilities) voidinit(ProcessingEnvironment processingEnv) booleanprocess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, getSupportedAnnotationTypes, getSupportedOptions, isInitialized
-
Field Details
-
utilities
protected com.sun.tools.javac.model.JavacElements utilities -
treeMaker
protected com.sun.tools.javac.tree.TreeMaker treeMaker
-
-
Constructor Details
-
CommentHasStringValueProcessor
public CommentHasStringValueProcessor()
-
-
Method Details
-
init
- Specified by:
initin interfaceProcessor- Overrides:
initin classAbstractProcessor
-
extractContext
private static com.sun.tools.javac.util.Context extractContext(com.sun.tools.javac.model.JavacElements utilities) -
process
- Specified by:
processin interfaceProcessor- Specified by:
processin classAbstractProcessor
-
getSupportedSourceVersion
- Specified by:
getSupportedSourceVersionin interfaceProcessor- Overrides:
getSupportedSourceVersionin classAbstractProcessor
-