Hm, such restriction seems to make little sense because spec also says you can have up to one method of each interception type within a single interceptor and those might need to use other than just Target(TYPE).

Either way, this is pretty easy to verify - I took one of the tests from Weld 2.4.8 and when I change binding to have another type I can see the following in logs:

WARN: WELD-000619: A lifecycle callback interceptor declares an interceptor binding with target other than ElementType.TYPE
  Interceptor [class org.jboss.weld.tests.interceptors.context.bindings.PostConstructInterceptor intercepts @BazBinding]
  Binding: org.jboss.weld.tests.interceptors.context.bindings.BazBinding
  Target: [TYPE, METHOD]

So it's being validated but only as a WARN, not an actual error.
The issue that introduced the check was https://issues.redhat.com/browse/WELD-1945

Matej

On Mon, Jul 1, 2024 at 11:54 AM Benjamin Confino <BENJAMIC@uk.ibm.com> wrote:
Thank you for getting back.

Regarding the specific part. This rule exists in JSR-318 Version 1.2 but was removed from JSR-318 Version 1.2A.

With the exception of AroundConstruct lifecycle callback interceptors, an interceptor for lifecycle callbacks may only declare interceptor binding types that are defined as Target(TYPE)

Our migration tools give a warning if you violate the that rule, but the customer's code is working fine. I informed them of the history of the spec and said it is likely that our tool is outdated, they asked for a confirmation that weld 2.4 is tracking the latest 1.2A version of JSR-318 and that is what I couldn't find documentation about.

From: Matej Novotny <manovotn@redhat.com>
Sent: 28 June 2024 06:37
To: Benjamin Confino <BENJAMIC@uk.ibm.com>
Cc: weld-dev@lists.jboss.org <weld-dev@lists.jboss.org>
Subject: [EXTERNAL] Re: [weld-dev] Question about weld-2.4
 
Hello, IIUIC, that maintenance release[1] didn't change any APIs, just added some clarifications to the specification? I know Weld used to consume the jboss version of interceptors APIs[2][3] in that older version but that shouldn't
Hello,

IIUIC, that maintenance release[1] didn't change any APIs, just added some clarifications to the specification?
I know Weld used to consume the jboss version of interceptors APIs[2][3] in that older version but that shouldn't matter given the API is identical.
That means the only way to tell would be some changes happening in Weld's core implementation and I can see that core releases for 2.x happened even after the release date of interceptors maintenance spec so I'd assume it was included.
However, the interceptor spec appendix is very vague and it's hard to tell what really changed (just that some parts were "clarified") so I guess it boils down to asking for a specific part that's not working for your customer and testing with Weld's behavior.

Regards
Matej
_____________________________________________________________

On Fri, Jun 28, 2024 at 1:13 AM Benjamin Confino <BENJAMIC@uk.ibm.com> wrote:
Hello

The CDI 1.2 spec refers to the java interceptors spec. On July 25, 2017 a new release of JSR 318, Version 12A, was published.

A customer was asking me if weld 2.4 was ever updated to include the changes in that spec release, I was not able to find the answer so I was hoping someone here will know.

Regards
Benjamin
Unless otherwise stated above:

IBM United Kingdom Limited
Registered in England and Wales with number 741598
Registered office: PO Box 41, North Harbour, Portsmouth, Hants. PO6 3AU
_______________________________________________
weld-dev mailing list -- weld-dev@lists.jboss.org
To unsubscribe send an email to weld-dev-leave@lists.jboss.org
Privacy Statement: https://www.redhat.com/en/about/privacy-policy
List Archives: https://lists.jboss.org/archives/list/weld-dev@lists.jboss.org/message/M7RHZHKW3LDHXYKYGBDMF5FHSPLOSULP/
Unless otherwise stated above:

IBM United Kingdom Limited
Registered in England and Wales with number 741598
Registered office: PO Box 41, North Harbour, Portsmouth, Hants. PO6 3AU