AnnotationProcessor option not recorgnized by any processor

…衆ロ難τιáo~ 提交于 2019-12-10 17:05:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!