[cdi-dev] dependent bean handling

Jozef Hartinger jharting at redhat.com
Thu Jun 5 03:24:00 EDT 2014


Agreed. This does not look right.

On 06/04/2014 06:13 PM, Mark Struberg wrote:
> Hi!
>
> I came across this in org.jboss.cdi.tck.tests.implementation.producer.method.definition.ProducerMethodDefinitionTest ,but other methods might contain something similar:
>
>      @Test
>      @SpecAssertions({ @SpecAssertion(section = DISPOSER_METHOD, id = "b") })
>      public void testStaticDisposerMethod() throws Exception {
>          assert getBeans(String.class, TAME_LITERAL).size() == 1;
>          String aString = getContextualReference(String.class, TAME_LITERAL);
>          Bean<String> stringBean = getBeans(String.class, TAME_LITERAL).iterator().next();
>          CreationalContext<String> creationalContext = getCurrentManager().createCreationalContext(stringBean);
>          stringBean.destroy(aString, creationalContext);
>          assert BeanWithStaticProducerMethod.stringDestroyed;
>      }
>
>
> the Dependent producer gets called via BeanManager#getReference _internally_ by using a 'throw away' CreationalContext
> And then you later create a _new_ CreationalContext and use this for bean.destroy.
>
> We should rather use the original CC. As is it now, this test is on the edge of being illegal ;)
>
> LieGrue,
> strub
>
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev



More information about the cdi-dev mailing list