问题
I have written an annotation processor. The user can pass an option as parameter for the processor. I can also read this parameter in my annotation processor. So far so good, everything works like expected!
However, I get a warning from the compiler, that the option passed to the annotation processor has not been recorgnized by any annotation processor:
Warning:The following options were not recognized by any processor: '[fragmentArgsLib]'
Actually, my processor has recognized and read this option successfully:
@Override public boolean process(Set<? extends TypeElement> type, RoundEnvironment env) {
String fragementArgsLib = processingEnv.getOptions().get("fragmentArgsLib");
...
}
I guess I have to say manually that I have used this option to make this compiler warning disappear. Does anyone of you know how to do that?
回答1:
Found the answer, you have to specify which options are supported by your annotation processor by overriding getSupportedOptions()
or using @SupportedOptions
annotation (since java 7)
来源:https://stackoverflow.com/questions/27607509/annotationprocessor-option-not-recorgnized-by-any-processor