Hi,
it seams there is an implementation error in InjectionResolver when resolving @Specializes annotated bean. The problem is in situation, when there are three producers.

1. Producer X
2. Producer Y
3. Producer Z directly override Y with @Specializes annotation

So there are three candidates that means result.size() == 3; This should throw AmbiguousResolutionException because even there is a Specialization there are still two candidate beans X and Z.

In such case the behaviour of the InjectionResolver.findBySpecialization method is:
-------------
        while (it.hasNext())
        {
            AbstractOwbBean<?> component = (AbstractOwbBean<?>) it.next();
            if (component.isSpecializedBean() && component.isEnabled())
            {
                res.add(component);
            }
        }

        if (res.size() > 0)
        {
            return res;
        }
------------
Because there is exactly one component marked as @Specializes this one is added to the res and than the res.size() == 1. But the specification says:

3.3.3. Specializing a producer method
If a producer method X is annotated @Specializes, then it must be non-static and directly override another producer method Y. Then X directly specializes Y, as defined in [specialization] <http://docs.jboss.org/cdi/spec/1.1/cdi-spec.html#specialization>. If the method is static or does not directly override another producer method, the container automatically detects the problem and treats it as a definition error.


In my opinion there is not implemented test if it is direct specialization and this is a bug. Am I right?

Regards


Vojtech Zavrel

--
Mgr. Vojtěch Zavřel
System architect
AURA, s.r.o.
Úvoz 499/56
602 00 Brno
Czech Republic

Tel.: +420 544 508 181
Fax: +420 544 508 112
E-mail: [email protected]
Internet: www.aura.cz
Certifikace ISO 9001, ISO 8000, ISO 27001 a ČOS 051622 (AQAP 2110)

Reply via email to