I've built an annotation processor for my Android project that builds a source file using JavaPoet. However, every time I need to call addModifiers
on any JavaPoet object, Android Studio flags it as an error. It will say either
Cannot resolve method addModifiers(javax.lang.model.element.Modifier)
or
addModifiers(javax.lang.model.element.Modifier) cannot be applied to javax.lang.model.element.Modifier
depending on which object I'm calling the method on. I've checked many times that the two fully qualified class names match perfectly. These methods in JavaPoet use VarArgs arguments, but that shouldn't make a difference since I'm compiling to Java 7.
Now here's the kicker: The package compiles just fine, and creates my source file. It only gives me the error in the IDE, not when javac runs. The modifiers are correct in the generated file.
So I guess what I want answered is: How do I get rid of the IDE error, and who do I report this to? Is this a JavaPoet issue, an Android Studio issue, or an IntelliJ issue, or something I haven't considered yet?