-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InterceptorBindingInheritanceTest relies on undefined behavior #468
Comments
Good find, this really should have been part of #464 but I missed it. |
The fix did introduce a new problem, thus I have to reopen it. InterceptorBindingInheritanceTest relies storing information in a static field of the contextual instance, but asserts the information on the proxy instance. Let me explain: in e.g The injected is the "Contextual Reference". Yes, our bean is But in the edit |
Maybe this problem does not bubble up in Weld as you create equals and hashcode method which equal the proxy with their respective contextual instances? If so then please point me to the section where this is defined please. |
Contextual reference for a pseudo-scoped bean is the contextual instance, so better be careful with the wording. There's no client proxy involved. However, I can see that this might be problematic if the CDI implementation in question implements interception using proxies (instead of subclasses). I vaguely remember thinking that this is not a valid implementation strategy at some point, but I no longer remember why. I might have easily been mistaken. I'll take another look on the test; I guess we could actually use a |
OWB does implement the proxy via subclassing. But how it does it is seemingly different to Weld. A static field would be perfectly fine for us - thanks Ladicek! |
ArC and Weld implement interception without proxying -- we generate a subclass of the bean class where we override intercepted methods such that invocation of the intercepted method starts the interception chain. An instance of that class becomes the contextual instance. It seems to me that you implement interception through proxying, so you need to differentiate between a "proper" contextual instance and an "interception proxy" instance. That is a little head-exploding situation :-), but the TCK obviously needs to support it. I'll try to submit a PR in a bit. |
Here's a proposed fix for the CDI TCK 4.0 branch: https://github.com/Ladicek/cdi-tck/commits/proxy-based-interception-fix-4.0 It works fine with ArC and Weld, could you please verify if that works for you? Thanks! |
I submitted a PR for the |
I don't mind the fix but I think we mostly agreed to do exclusions for these cases; a comment explaining why would be neat if you decide for the exclusion. |
Yeah, since 4.1 is near, I think we should go for exclusions. I only uploaded a branch with a fix for 4.0 so that you could verify it. (The PR I did open is for 4.1.) |
Yeah, I forgot to note I tested that branch as well and it works fine too. |
To go into detail a bit more because I feel there is potential for non portability ahead in the interceptor area: |
Yes, IIRC the interceptor subclass is the contextual instance.
The invocation needs to be via contextual reference for it to classify as bussiness method invocation (in your scenario). Therefore, in the case you described, if you make a direct method call, it won't trigger interception. |
We now have a fix for the |
Similarly to #464, two tests in
InterceptorBindingInheritanceTest
rely on recursive interception being prevented by the container, which is not defined properly anywhere and is unrelated to the stated purpose of the test (which is inheritance of interceptor binding annotations).It is relatively straightforward to modify the test to not trigger recursive interception, which is what I propose we do.
The text was updated successfully, but these errors were encountered: