The specification does not clearly say whether I can usefully declare a @Qualfier type like this:
@Qualifier
@Retention(RUNTIME)
@Target({TYPE, TYPE_USE})
public @interface Special {}
To be clear, it doesn't disallow this, but it's unclear if an implementation is required to recognize the qualifier when it occurs as follows:
@Inject @Special Thing thing;
The reason being, of course, that here @Special is an annotation of the type use Thing, and not of the field thing.
In fact, it's extremely natural to view qualifier annotations as qualifying the type use rather than the injection point itself, and I guess the reason we didn't define it that was in CDI 1.0 was that we didn't have type annotations at that time.
Some implementation probably already allow this. I think the spec should be changed to clarify that this is a required feature.
All of the above also applies to interceptor binding types.
The specification does not clearly say whether I can usefully declare a
@Qualfiertype like this:To be clear, it doesn't disallow this, but it's unclear if an implementation is required to recognize the qualifier when it occurs as follows:
The reason being, of course, that here
@Specialis an annotation of the type useThing, and not of the fieldthing.In fact, it's extremely natural to view qualifier annotations as qualifying the type use rather than the injection point itself, and I guess the reason we didn't define it that was in CDI 1.0 was that we didn't have type annotations at that time.
Some implementation probably already allow this. I think the spec should be changed to clarify that this is a required feature.
All of the above also applies to interceptor binding types.