I dare disagree, from my perspective, you are not restricting the set (you are not using @Typed at all btw) - you are replacing whole underlying AT with another one. Regarding spec, 2.2 and 3.2.1 basically says that unrestricted set of bean types is based on return type (and follows up with a precise definition how to derive that from interface/primitive/class). So yes, that holds true, until you start changing the method which is the case here. You basically take the existing one as a template, alter it and put in there instead. As with many custom things in extensions, you might break your code easily (e.g. your example with Tomato) but that's your problem, really. I think you are enforcing rules which aren't implied by spec and might be unnecessarily strict. Ofc we both might be wrong, so it would be nice if we get to hear some more opinions |