You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "John D. Ament" <jo...@apache.org> on 2017/08/06 12:07:39 UTC

Why does CDI.current() include a Default Qualifier?

Hey guys

Before I create a ticket, I wanted to understand from your POV.  I'm not
sure if it's a spec issue.

I noticed in OWB when I do CDI.current().select(SomeClass, someQualifiers)
the resulting instance includes a Default qualifier.  However, when I do
CDI.current().select(SomeClass).select(someQualifiers) it does not.

I noticed that adding the Default qualifier was done in this commit [1].
However, I don't believe this is correct.  I looked through the spec, I
can't find any reference that the instance should have a default qualifier
on it.

This causes an issue with 3rd party beans.  If I try to do something like
programmatically lookup a bean where the qualifiers don't include a default
qualifier, then the lookup fails.

John

Re: Why does CDI.current() include a Default Qualifier?

Posted by "John D. Ament" <jo...@apache.org>.
Ok, yes that sounds vaguely familiar.  Basically, if no qualifiers are
chosen then default should be used, but as soon as you add a qualifier
Default should be removed.

On Sun, Aug 6, 2017 at 10:03 AM Romain Manni-Bucau <rm...@gmail.com>
wrote:

> Dont recall the whole details and 90% sure spec is not that closed on that
> point but if you dont have an implicit default, direct type lookup doesnt
> work but if another qualifier is set the *implicit* one (not default, only
> default when implicit) should be stripped IMHO.
>
> Le 6 août 2017 14:46, "John D. Ament" <jo...@apache.org> a écrit :
>
> > Another issue, which may be related.
> >
> > When I use the following to look up a bean, the bean doesn't have a
> default
> > qualifier but BeanManager.getReference is attempting to add one
> >
> > beanManager.getReference(bean, bean.getBeanClass(),
> > beanManager.createCreationalContext(bean))
> >
> > This was just a regular bean, not a third party bean.
> >
> > On Sun, Aug 6, 2017 at 8:07 AM John D. Ament <jo...@apache.org>
> > wrote:
> >
> > > Hey guys
> > >
> > > Before I create a ticket, I wanted to understand from your POV.  I'm
> not
> > > sure if it's a spec issue.
> > >
> > > I noticed in OWB when I do CDI.current().select(SomeClass,
> > someQualifiers)
> > > the resulting instance includes a Default qualifier.  However, when I
> do
> > > CDI.current().select(SomeClass).select(someQualifiers) it does not.
> > >
> > > I noticed that adding the Default qualifier was done in this commit
> [1].
> > > However, I don't believe this is correct.  I looked through the spec, I
> > > can't find any reference that the instance should have a default
> > qualifier
> > > on it.
> > >
> > > This causes an issue with 3rd party beans.  If I try to do something
> like
> > > programmatically lookup a bean where the qualifiers don't include a
> > default
> > > qualifier, then the lookup fails.
> > >
> > > John
> > >
> >
>

Re: Why does CDI.current() include a Default Qualifier?

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Dont recall the whole details and 90% sure spec is not that closed on that
point but if you dont have an implicit default, direct type lookup doesnt
work but if another qualifier is set the *implicit* one (not default, only
default when implicit) should be stripped IMHO.

Le 6 août 2017 14:46, "John D. Ament" <jo...@apache.org> a écrit :

> Another issue, which may be related.
>
> When I use the following to look up a bean, the bean doesn't have a default
> qualifier but BeanManager.getReference is attempting to add one
>
> beanManager.getReference(bean, bean.getBeanClass(),
> beanManager.createCreationalContext(bean))
>
> This was just a regular bean, not a third party bean.
>
> On Sun, Aug 6, 2017 at 8:07 AM John D. Ament <jo...@apache.org>
> wrote:
>
> > Hey guys
> >
> > Before I create a ticket, I wanted to understand from your POV.  I'm not
> > sure if it's a spec issue.
> >
> > I noticed in OWB when I do CDI.current().select(SomeClass,
> someQualifiers)
> > the resulting instance includes a Default qualifier.  However, when I do
> > CDI.current().select(SomeClass).select(someQualifiers) it does not.
> >
> > I noticed that adding the Default qualifier was done in this commit [1].
> > However, I don't believe this is correct.  I looked through the spec, I
> > can't find any reference that the instance should have a default
> qualifier
> > on it.
> >
> > This causes an issue with 3rd party beans.  If I try to do something like
> > programmatically lookup a bean where the qualifiers don't include a
> default
> > qualifier, then the lookup fails.
> >
> > John
> >
>

Re: Why does CDI.current() include a Default Qualifier?

Posted by "John D. Ament" <jo...@apache.org>.
Another issue, which may be related.

When I use the following to look up a bean, the bean doesn't have a default
qualifier but BeanManager.getReference is attempting to add one

beanManager.getReference(bean, bean.getBeanClass(),
beanManager.createCreationalContext(bean))

This was just a regular bean, not a third party bean.

On Sun, Aug 6, 2017 at 8:07 AM John D. Ament <jo...@apache.org> wrote:

> Hey guys
>
> Before I create a ticket, I wanted to understand from your POV.  I'm not
> sure if it's a spec issue.
>
> I noticed in OWB when I do CDI.current().select(SomeClass, someQualifiers)
> the resulting instance includes a Default qualifier.  However, when I do
> CDI.current().select(SomeClass).select(someQualifiers) it does not.
>
> I noticed that adding the Default qualifier was done in this commit [1].
> However, I don't believe this is correct.  I looked through the spec, I
> can't find any reference that the instance should have a default qualifier
> on it.
>
> This causes an issue with 3rd party beans.  If I try to do something like
> programmatically lookup a bean where the qualifiers don't include a default
> qualifier, then the lookup fails.
>
> John
>