Skip to content
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

InvocationContextTest#testGetTargetMethod() relies on undefined behavior #464

Closed
manovotn opened this issue May 23, 2023 · 0 comments · Fixed by #465
Closed

InvocationContextTest#testGetTargetMethod() relies on undefined behavior #464

manovotn opened this issue May 23, 2023 · 0 comments · Fixed by #465
Labels
accepted Issue/challenge is accepted challenge TCK test challenge

Comments

@manovotn
Copy link
Contributor

I believe the TCK test InvocationContextTest#testGetTargetMethod() is incorrect in how it tests given behavior.
It currently relies on recursive interception to verify that InvocationContext#getTarget() returns the same instance of a bean. Namely the test invokes simpleBean.getId() and the around invoke interceptor then uses InvocationContext#getTarget() to obtain an instance of SimpleBean and invokes getId() again.

Correct me if I am wrong, but I couldn't find any evidence in CDI or Interceptors specs that would imply recursive interception is supported or even supposed to work. Now, I am not for or against that feature but if we want it, it should have it's own clear definition in either spec and its dedicated TCK test.

Note that the exact same test goal can be achieved without use of recursive interception (for instance a static field in the interceptor and comparing the two instances?). Therefore, we should be able to tweak the test to avoid recursive interception invocations without losing any coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Issue/challenge is accepted challenge TCK test challenge
Projects
None yet
2 participants