Currently, @Named does not support TYPE_USE target, so the following code does not compile:
...Provider<@Named("app.config") Properties>...
It would be great if Guice supported TYPE_USE for @Qualifiers as the qualifier seems to belong to a type rather than method/field/class.
At the same time, it might be worth recommending TYPE_USE as the only target for @Qualifier implementations. Of course, refactoring the current @Named might change a lot, so I would like to support TYPE_USE, and decide with @Named later.
See:
Currently,
@Nameddoes not supportTYPE_USEtarget, so the following code does not compile:It would be great if Guice supported
TYPE_USEfor@Qualifiersas the qualifier seems to belong to a type rather than method/field/class.At the same time, it might be worth recommending
TYPE_USEas the only target for@Qualifierimplementations. Of course, refactoring the current@Namedmight change a lot, so I would like to supportTYPE_USE, and decide with@Namedlater.See:
TYPE_USEfor its@Qualifier. Note that it supportsFIELD,METHODand so on for backward compatibility, and I think newly-created qualifier annotations should not haveFIELD,METHOD, and the rest targets.TYPE_USEshould be the right target just like jspecify's@Nullable