]
Gerhard Petracek commented on WELD-907:
---------------------------------------
the first test on glassfish 3.2 (snapshot) looks a bit better. i'll have a closer look
at it (later on).
bean-lookup issue in Context#get(Contextual, CreationalContext)
---------------------------------------------------------------
Key: WELD-907
URL:
https://issues.jboss.org/browse/WELD-907
Project: Weld
Issue Type: Bug
Components: Scopes & Contexts
Affects Versions: 1.1.1.Final
Reporter: Gerhard Petracek
this is a very special case which used to work before weld v1.1.1
e.g.:
Set<Bean<?>> beans1 = beanManager.getBeans(MyBean.class);
Class beanClass = beans.iterator().next().getBeanClass();
Set<Annotation> qualifiers = beans.iterator().next().getQualifiers();
Set<Bean<?>> beans2 = beanManager.getBeans(beanClass, qualifiers.toArray(new
Annotation[qualifiers.size()]));
beans1 is the same as beans2
that works without problems.
if you use the same in
Context#get(Contextual, CreationalContext)
it doesn't work. i haven't looked at the details but it might be due to the
performance optimizations.
the following example isn't that useful (so please don't ask for the reason) -
it's just the minimal code to reproduce the issue.
public <T> T get(Contextual<T> component, CreationalContext<T>
creationalContext)
{
Class beanClass = ((Bean<T>)component).getBeanClass();
Set<Annotation> qualifiers = ((Bean<T>)component).getQualifiers();
Set<Bean<?>> beans = CdiUtils.getBeanManager().getBeans(beanClass,
qualifiers.toArray(new Annotation[qualifiers.size()]));
//beans is empty
}
it isn't specified that it should work but it used to work with weld and it also
works with owb.
since there is (imo) no reason why it shouldn't work, it would be great if it gets
fixed!
--
This message is automatically generated by JIRA.
For more information on JIRA, see: