in bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java [122:167]
public <A> void processAnnotatedType(final @Observes ProcessAnnotatedType<A> pat) {
if (!isExecutableValidationEnabled) {
return;
}
final AnnotatedType<A> annotatedType = pat.getAnnotatedType();
if (!annotatedTypeFilter.accept(annotatedType)) {
return;
}
final Class<A> javaClass = annotatedType.getJavaClass();
final int modifiers = javaClass.getModifiers();
if (!javaClass.isInterface() && !javaClass.isAnonymousClass() && !Modifier.isFinal(modifiers) && !Modifier.isAbstract(modifiers)) {
try {
Queue<Class<?>> toProcess = new LinkedList<>();
toProcess.add(annotatedType.getJavaClass());
while (!toProcess.isEmpty()) {
Class<?> now = toProcess.poll();
Executable[] methods = now.getMethods();
Executable[] constructors = now.getConstructors();
if (hasValidation(now)
|| hasValidation(methods) || hasValidation(constructors)
|| hasParamsWithValidation(methods) || hasParamsWithValidation(constructors)) {
pat.setAnnotatedType(new BValAnnotatedType<>(annotatedType));
break;
}
// Nothing found, collect superclass/interface and repeat (See BVAL-222)
if (now.getSuperclass() != Object.class && now.getSuperclass() != null) {
toProcess.add(now.getSuperclass());
}
toProcess.addAll(Arrays.asList(now.getInterfaces()));
}
} catch (final Exception e) {
if (e instanceof ValidationException) {
throw e;
}
LOGGER.log(Level.INFO, e.getMessage());
} catch (final NoClassDefFoundError ncdfe) {
// skip
}
}
}