See gh-45231
This commit is contained in:
Andy Wilkinson
2025-04-17 16:00:53 +01:00
parent 8641df7209
commit a5722832d2

View File

@@ -136,8 +136,11 @@ final class ArchitectureRules {
private static DescribedPredicate<JavaClass> notAnnotatedWithRoleInfrastructure() {
return is("not annotated with @Role(BeanDefinition.ROLE_INFRASTRUCTURE", (candidate) -> {
if (!candidate.isAnnotatedWith(Role.class)) {
return true;
}
Role role = candidate.getAnnotationOfType(Role.class);
return (role == null) || (role.value() != BeanDefinition.ROLE_INFRASTRUCTURE);
return role.value() != BeanDefinition.ROLE_INFRASTRUCTURE;
});
}