[
https://issues.apache.org/jira/browse/OWB-1017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14160478#comment-14160478
]
Antonin Stefanutti commented on OWB-1017:
-----------------------------------------
I've just tested it and it happens that an issue occurs when the intercepted
bean contains both a class-level binding and a method-level binding, the issue
being that a {{@AroundConstruct}} callback defined in the interceptor bound to
the method-level binding is called while it should not. I'm attaching the
minimal use case that I've been able to isolate but in essence that boils down
to the following call stack:
{code}
private boolean intercepts(Interceptor<?> interceptor, Annotation[]
requestedInterceptorBindings)
{
...
if (!inBindingArray(at, interceptorBinding,
requestedInterceptorBindings)) // <=
{
return false;
}
...
}
private boolean inBindingArray(final AnnotatedType<?> at, final Annotation
interceptorBinding, final Annotation[] requestedInterceptorBindings)
{
...
if (AnnotationUtil.isCdiAnnotationEqual(at, requestedBinding,
interceptorBinding))
{
return true;
}
...
}
public static boolean isCdiAnnotationEqual(final AnnotatedType<?> at, final
Annotation annotation1, final Annotation annotation2)
{
...
// check if the annotationTypes are equal
if (qualifier1AnnotationType == null
||
!qualifier1AnnotationType.equals(annotation2.annotationType())) // <= issue
happens here
{
return false;
}
...
}
{code}
The comparison returns true as {{qualifier1AnnotationType}} and {{annotation2}}
are the same class. Probably the proper check should be comparing
{{annotation1}} and {{annotation2}}.
> Adding an annotated type as interceptor binding does not take the annotated
> type metadata into account
> ------------------------------------------------------------------------------------------------------
>
> Key: OWB-1017
> URL: https://issues.apache.org/jira/browse/OWB-1017
> Project: OpenWebBeans
> Issue Type: Bug
> Components: Lifecycle
> Affects Versions: 1.5.0
> Reporter: Antonin Stefanutti
> Assignee: Romain Manni-Bucau
> Fix For: 1.5.0
>
>
> When calling the {{BeforeBeanDiscovery.addInterceptorBinding(AnnotatedType<?
> extends Annotation>)}} method, the metadata of the provided {{AnnotatedType}}
> argument are not taken into account. A typical use case is when some of the
> members of the provided annotated type have been decorated with the
> {{@NonBinding}} annotation.
> Indeed, the implementation in the
> {{org.apache.webbeans.portable.events.discovery.BeforeBeanDiscoveryImpl}}
> class delegate to the class-based version of the
> {{BeforeBeanDiscovery.addInterceptorBinding}} method by losing all the
> metadata information in the process.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)