quarkus: Repeated @InterceptorBinding are ignored by arc-processor
I struggled for a while today with a repeatable interceptor binding that was ignored by arc-processor until I found in debug mode why it is ignored.
Let’s assume the interceptor binding looks like this:
@InterceptorBinding
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE, ElementType.METHOD })
@Repeatable(Bar.class)
public @interface Foo {
@Nonbinding
String someValue() default "";
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@interface Bar {
Foo[] value();
}
}
And is used that way:
@ApplicationScoped
public class EmptyService {
@Foo(someValue = "one")
@Foo(someValue = "two")
public void doSomething() {
}
}
Then, in the following code the repeated interceptor bindings will be ignored because beanDeployment doesn’t know any interceptor binding named Foo$Bar:
https://github.com/quarkusio/quarkus/blob/dda2f83a1c0b1ca65884e4a0b65fc80070e57418/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java#L158-L160
Here’s the value of methodAnnotations during the code execution:
[@Bar(value = [@Foo(someValue = "1"),@Foo(someValue = "2")])]
@mkouba Am I wrong trying to use repeatable interceptor bindings or is this a bug? It currently works when the bindings are added using an AnnotationsTransformer but I’d like it to work without the transformer as well.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (19 by maintainers)
@mkouba No, I agree, I reproduced the test from Weld (linked above), which only has method-level bindings, and that was rather straightforward to implement. Then I started wondering about class-level bindings and it became interesting 😃 I’ll tie some loose ends and submit a PR, then we can discuss.
@mkouba @gwenneg I agree that specs aren’t clear about this so I’ve create this issue in interceptors spec - https://github.com/eclipse-ee4j/interceptor-api/issues/81