| Summary: | Annotation Processor can't response supported annotation in jdt-apt | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Dean Xu <373216024> |
| Component: | APT | Assignee: | Generic inbox for the JDT-APT component <jdt-apt-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | eclipse |
| Version: | 4.8 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 8 | ||
| Whiteboard: | stalebug | ||
It seems like you have everything configured correctly. So the problem must be something a little bit subtle. I wonder whether the processor and the code in project B are somehow getting their definitions of MyAnno from different classpaths? Is MyAnno defined anywhere else, such as on some other jar file in project B's classpath? As an experiment, is it possible to change the name or package of MyAnno to something unique, to test that hypothesis? This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Here is my project strcture: Project A(jar): -a/b/c -MyAnno.class (annotation, target=method) -MyAnnoProcessor.class (@SupportedAnnotationTypes("a.b.c.MyAnno")) -META-INF -services -javax.annotation.processing.Processor Project B (in eclipse, dependency to Project A by maven) -d/e/f -MyClass.java (used @MyAnno on its methods) -prperties -> java compiler -> annotation processor -> factory path -> Project A.jar Then I trigger the eclipse build, the Processor really init but process method never invoked. Because eclipse jdt-apt don't find any element has annotation @MyAnno (which is actually exists). I try to change the @SupportedAnnotationTypes to @SupportedAnnotationTypes("*"). It invokes process method, but I RoundEnvironment.getElementsAnnotatedWith(MyAnno.class) returns empty collection. While all above will work OK in maven(with javac). Did I miss something or it's a bug?