Hi!
To be honest: I'm not sure.
Fact is: this is not an optimal situation and yes this this not the first time
the JSR-299 spec uses a 330 annotation slightly different as they originally
_thought_ about (see @Scope -> pseudo scope). I'm not a fan of this, but it's
hard to argue against it since JSR-330 is so minimalistic that it simply
doesn't define it pinned to the point.
Looking at the JavaDoc from the lastest JSR-330 code [1] unveils the fact that
there is no type safety or any other kind of resolution algorithm specified!
I don't think Bob had this in mind, but the way 299 uses it is at least not
forbidden.
Maybe it would have been best to stick with @BindingType and define
@Qualifier
public @interface BindingType{}
Fact is: since @Named has @Qualifier, it is a 'binding type' as specified in
the spec 2.3 "Qualifiers" section, isn't?
Pete, sorry to pull you in, but maybe this discussion is also interesting for
you. Wdyt, anything we do/got wrong?
LieGrue,
strub
[1] http://atinject.googlecode.com/svn/trunk/src/javax/inject/Qualifier.java
--- On Fri, 9/4/09, Gurkan Erdogdu <[email protected]> wrote:
> From: Gurkan Erdogdu <[email protected]>
> Subject: Re: @Named - a naming or qualifying annotation?
> To: [email protected]
> Date: Friday, September 4, 2009, 1:12 PM
> Yeah, you seem right!
>
> In at-inject module source, there is no @Qualifier on class
> Named.
>
> Mark WDYT ?
>
> Thanks;
>
> --Gurkan
>
> 2009/9/4 Sven Linstaedt <[email protected]>
>
> > While further investigating the recent changes in OWB
> due to JSR 330 I
> > stumbled upon the mismatch of @Named in OWB and in JSR
> 330. In 330 it is
> > defined as a qualifying annotation as far as I know
> (based on my knowledge
> > about Guice and
> > http://atinject.googlecode.com/svn/trunk/src/javax/inject/Named.java),
> but
> > OWB use it as a simple annotation.
> >
> > From my point of view this is a conceptual mismatch:
> One spec uses the
> > annotation just for binding specific beans to a
> literal name, the other one
> > uses it for differentiate between multiple beans. Even
> this should be no
> > immediate issue for JSR 299's typesafe resolution
> mechanism, if a single
> > bean is further qualified with specific @Named name, I
> do not feel well, if
> > people are going to use this annotation as a
> qualifying one like
> > @Named("stage_test") on multiple bans. The EL
> namespace gets polluted with
> > unresolvable names and developers become potentially
> confused by the
> > conceptually ambiguously usage of the annotation.
> >
> > Your opinion?
> >
> >
> > br, Sven
> >
>
>
>
> --
> Gurkan Erdogdu
> http://gurkanerdogdu.blogspot.com
>