| Summary: | Method's annotation attribute is compiled as annotation on return type | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Benjamin G <bgaraude> | ||||
| Component: | Core | Assignee: | Srikanth Sankaran <srikanth.sankaran> | ||||
| Status: | CLOSED MOVED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | srikanth.sankaran | ||||
| Version: | 4.17 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 10 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
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, I will carry over the test case from here into the PR https://github.com/eclipse-jdt/eclipse.jdt.core/pull/1097 |
Created attachment 284564 [details] Test case If I have an annotation 'Ann' whose @Target is METHOD. This annotation declares an attribute value whose type is another annotation 'Child' without @Target. Then, I annotate a method with this annotation and compile it with JDT. When I call getAnnotatedReturnType() on the java.lang.Method, I receive an array with one element being the @Child annotation. If I compile the code with javac, getAnnotatedReturnType() returns an empty array, which seems correct. A workaround is to add @Target({}) on @Child, in this case, JDT behaves as javac. This occurs on eclipse 2020-09. I've attached a test case that reproduces the issue. If you compile it with eclipse, you should reproduce the issue. While compiled with javac, the test passes.