| Summary: | field.getAnnotatedType().getAnnotations() broken in the latest ECJ version | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Andres Luuk <mysticel> | ||||
| Component: | Core | Assignee: | Srikanth Sankaran <srikanth.sankaran> | ||||
| Status: | CLOSED MOVED | QA Contact: | Jay Arthanareeswaran <jarthana> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | jarthana, srikanth.sankaran | ||||
| Version: | 4.17 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 10 | ||||||
| See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=552082 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Just to be sure, you are not expecting the annotations with no @Target to show up on the type of field, right? If that's the case, then I think we are looking at bug 552082. This was forced by some change on the spec, but strangely was never implemented fully by the Javac. I read though the case. I think you are right. It is probably the same case. I think the only difference here is that, I got the issue from runtime and not from compile time. So currently cases like this will be compiled differently with jdk and ecj. I will just ignore the case for ecj then and if/once they fix the JDK runtime I will revisit the use case on our side. (In reply to Andres Luuk from comment #2) > I read though the case. > I think you are right. It is probably the same case. > I think the only difference here is that, I got the issue from runtime and > not from compile time. > So currently cases like this will be compiled differently with jdk and ecj. > I will just ignore the case for ecj then and if/once they fix the JDK > runtime I will revisit the use case on our side. Thanks. Also as workaround, you can use specific targets for the affected annotations. 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. This is fixed by https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1096 and I will include the test case from here into the PR https://github.com/eclipse-jdt/eclipse.jdt.core/pull/1097 |
Created attachment 284087 [details] Repro case, run new Test().test(); to reproduce. I upgraded my org.eclipse.jdt:ecj from 3.19.0 to the latest version of 3.22.0. And now field.getAnnotatedType().getAnnotations() behaves differently from the default jdk. If I compile the class with 3.19.0 or on openjdk jdk it returns only TestAnnFirst at runtime. But with the latest ecj (3.22.0) it returns 2 annotations. I provided a test case on how to reproduce it. I run the same issue on JDK8 and also on JDK14.