Skip to content

Commit

Permalink
Arc - treat non-inherited interceptor bindings properly even outside …
Browse files Browse the repository at this point in the history
…strict mode
  • Loading branch information
manovotn committed Sep 18, 2024
1 parent 2f9954b commit 04deb1d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ public class CdiClassLevelInheritanceTest {
SubclassRolesAllowedBean.class,
SubclassAuthenticatedBean.class,
TestException.class,
SecurityTestUtils.class))
// Following configuration tells Arc to *not* automatically inherit all class level annotations
.overrideConfigKey("quarkus.arc.strict-compatibility", "true");
SecurityTestUtils.class));

@Test
public void testDenyAllInherited() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -930,9 +930,7 @@ private void doAddClassLevelBindings(ClassInfo classInfo, Collection<AnnotationI
if (classInfo.superClassType() != null && !classInfo.superClassType().name().equals(DotNames.OBJECT)) {
ClassInfo superClass = getClassByName(beanDeployment.getBeanArchiveIndex(), classInfo.superName());
if (superClass != null) {
// proper interceptor binding inheritance only in strict mode, due to Quarkus expecting security
// annotations (such as `@RolesAllowed`) to be inherited, even though they are not `@Inherited`
doAddClassLevelBindings(superClass, bindings, skip, beanDeployment.strictCompatibility);
doAddClassLevelBindings(superClass, bindings, skip, true);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class InheritedBindingOnBeanTest {
@RegisterExtension
public ArcTestContainer container = new ArcTestContainer.Builder()
.beanClasses(MyBean.class, FooBinding.class, BarBinding.class, FooInterceptor.class, BarInterceptor.class)
.strictCompatibility(true) // correct interceptor binding inheritance
.build();

@Test
Expand Down

0 comments on commit 04deb1d

Please sign in to comment.