[weld-dev] Interceptor & Interceptors

Emily Jiang EMIJIANG at uk.ibm.com
Thu Jun 1 05:26:44 EDT 2017


Thank you Martin, Tomas and Matej for your quick response! 

Martin, it looks like the two issues you mentioned might be the reason for 
the Interceptor wording changes.

As suggested by Tomas, we did a bit experiments.

In the following code snippet

@Interceptors (Interceptor0.class)
public class MyBean{

public void myMethod(){
}
}
Interceptor binding: MyInterceptorBinding

public class Interceptor0 {

}

We verified the current Weld behaviour:


1. add @Interceptor, @Priority(1), @MyInterceptorBinding to Interceptor0
The interceptor0 was invoked twice on invoking myMethod - basically the 
@Interceptor annotation is not ignored.

2. add  @Interceptor, @Priority(1) to Interceptor0
The Interceptor0 was invoked once, which means @Interceptor annotation is 
ignored, which corresponds to the issue [1].

3. add @Interceptor, @MyInterceptorBinding
The interceptor0 was invoked once, which means @Interceptor annotation is 
ignored, which corresponds to the issue [2]


According to Interceptor updated sentence ("The Interceptor annotation is 
ignored on interceptor classes bound 
>> using the Interceptors annotation.") , the spec wording seems to 
suggest to ignore the @Interceptor binding completely for the above 3 
scenarios, which means the Interceptor0 should only be invoked once. Which 
do you think? This seems to be a behaviour change. If this is the case, we 
need to suggest to the Interceptor spec for more clarification.

[1] https://github.com/javaee/interceptors-spec/issues/27
[2] https://github.com/javaee/interceptors-spec/issues/23
Many thanks,
Emily
===========================
Emily Jiang
WebSphere Application Server, CDI & MicroProfile Development Lead
 
MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
Phone:  +44 (0)1962 816278  Internal: 246278

Email: emijiang at uk.ibm.com 
Lotus Notes: Emily Jiang/UK/IBM at IBMGB




From:   Martin Kouba <mkouba at redhat.com>
To:     Emily Jiang <EMIJIANG at uk.ibm.com>, weld-dev 
<weld-dev at lists.jboss.org>
Date:   01/06/2017 08:17
Subject:        Re: [weld-dev] Interceptor & Interceptors



Tomas Remes pointed out that the new/upcoming version contains the new 
sentence which also mentions @Interceptor.

I think it's related to:
https://github.com/javaee/interceptors-spec/issues/27

But it's hard to guess as it's not possible to track the changes - 
sources are binary files.

Martin


Dne 1.6.2017 v 08:07 Martin Kouba napsal(a):
> Hi Emily,
> 
> I suppose you're talking about section 5.3 Ordering Interceptors using 
> the Priority Annotation:
> "The Priority annotation is ignored on interceptors bound to a component 

> using the Interceptors annotation."
> 
> There is a very old clarification issue for the interceptor spec:
> https://github.com/javaee/interceptors-spec/issues/23
> (originally INTERCEPTORS_SPEC-23)
> 
> Martin
> 
> Dne 31.5.2017 v 14:53 Emily Jiang napsal(a):
>> Hi Martin,
>>
>> In the updated Interceptor spec, it has the following statement:
>>
>> "The Interceptor annotation is ignored on interceptor classes bound 
>> using the Interceptorsannotation."
>>
>> I assume this already the case in Weld 2.x, CDI 1.2 implementation. 
>> Right?
>>
>> Many thanks,
>> Emily
>> ===========================
>> Emily Jiang
>> WebSphere Application Server, CDI & MicroProfile Development Lead
>>
>> MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
>> Phone:  +44 (0)1962 816278  Internal: 246278
>>
>> Email: emijiang at uk.ibm.com
>> Lotus Notes: Emily Jiang/UK/IBM at IBMGB
>>
>> Unless stated otherwise above:
>> IBM United Kingdom Limited - Registered in England and Wales with 
>> number 741598.
>> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 
>> 3AU
>>
>>
>> _______________________________________________
>> weld-dev mailing list
>> weld-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/weld-dev
>>
> 

-- 
Martin Kouba
Senior Software Engineer
Red Hat, Czech Republic



Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20170601/db6724bb/attachment.html 


More information about the weld-dev mailing list