Open GoogleCodeExporter opened 9 years ago
This feature request will not work unless the following holds in 99%+ of all
cases:
_IF_ someone creates their own qualifier annotation (and thus, sticks
@Qualifier or possibly @BindingAnnotation on their public @interface
declaration), then either:
(A) there is no @Target annotation at all, or
(B) the @Target annotation always includes at least both ElementType.FIELD and
ElementType.PARAMETER
Assuming that's true, we need to resolve the annotation in order to know what
annotations are on the annotation definition. In fact, we have to resolve _ALL_
annotations on _ALL_ fields in order to know which ones are @Qualifiers /
@BindingAnnotation-marked.
Resolving is very very tricky, so, I don't think this is worth it - assuming it
can be done in the first place (which requires these things to always have no
@Target or both param/field, as described earlier).
Original comment by r.spilker
on 21 Aug 2014 at 8:35
As far as I know, B is required by the spec, so that shouldn't be an issue (and
we can simply emit an error if the annotation doesn't have @Target PARAMETER).
Original comment by jorn86
on 21 Aug 2014 at 9:10
No idea about the spec, but I'd say that a binding annotation actually always
allows targets FIELD and PARAMETER. Normally, you use constructor injection
(i.e. PARAMETER), but sometimes it's not possible and you switch to FIELD (or
method). Moreover, the annotation comes usually from the programmer who uses
it, so they can change the @Target, if needed.
The resolution is a different story, so I'm afraid we've to stick with
@OnConstructor for a while.
Original comment by Maaarti...@gmail.com
on 27 Aug 2014 at 3:38
Original issue reported on code.google.com by
jorn86
on 20 Aug 2014 at 10:28