Class AbstractErrorAbsorbingProcessor
- java.lang.Object
-
- javax.annotation.processing.AbstractProcessor
-
- org.uberfire.annotations.processors.AbstractErrorAbsorbingProcessor
-
- All Implemented Interfaces:
Processor
- Direct Known Subclasses:
ExperimentalFeatureProcessor,PerspectiveProcessor,WorkbenchClientEditorProcessor,WorkbenchContextProcessor,WorkbenchEditorProcessor,WorkbenchPopupProcessor,WorkbenchScreenProcessor,WorkbenchSplashScreenProcessor
public abstract class AbstractErrorAbsorbingProcessor extends AbstractProcessor
Contains a series of adaptations and workarounds to make annotation processors work well under Eclipse JDT APT. Does not limit compatibility with other annotation processing environments (such as javac).
-
-
Field Summary
-
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractErrorAbsorbingProcessor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidinit(ProcessingEnvironment env)Wraps the given processing environment with one that protects against known bugs in the Eclipse annotation processing implementation.booleanprocess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)protected abstract booleanprocessWithExceptions(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)Same contract asprocess(Set, RoundEnvironment), except that any exceptions thrown are caught and printed as messages of typeDiagnostic.Kind.ERROR.protected voidrememberInitializationError(Throwable t)Subclasses must call this from their constructors if something throws an exception during initialization of the instance.protected voidwriteCode(String packageName, String className, StringBuffer code)Writes the given code to javac's Filer.-
Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, getSupportedAnnotationTypes, getSupportedOptions, getSupportedSourceVersion, isInitialized
-
-
-
-
Method Detail
-
init
public void init(ProcessingEnvironment env)
Wraps the given processing environment with one that protects against known bugs in the Eclipse annotation processing implementation.- Specified by:
initin interfaceProcessor- Overrides:
initin classAbstractProcessor
-
process
public final boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
- Specified by:
processin interfaceProcessor- Specified by:
processin classAbstractProcessor
-
rememberInitializationError
protected void rememberInitializationError(Throwable t)
Subclasses must call this from their constructors if something throws an exception during initialization of the instance. Once this method has been called with a non-null throwable, theprocessWithExceptions(Set, RoundEnvironment)method will not be called on this instance.- Parameters:
t- the exception that occurred (and was caught) during instance creation of this annotation processor instance.
-
processWithExceptions
protected abstract boolean processWithExceptions(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws Exception
Same contract asprocess(Set, RoundEnvironment), except that any exceptions thrown are caught and printed as messages of typeDiagnostic.Kind.ERROR. This is done to keep Eclipse JDT from going into an infinite processing loop.- Throws:
Exception
-
writeCode
protected final void writeCode(String packageName, String className, StringBuffer code) throws IOException
Writes the given code to javac's Filer.- Throws:
IOException
-
-