Skip to content

Commit

Permalink
Hibernate Validator - Normalize ClientProxy for bean metadata retrieval
Browse files Browse the repository at this point in the history
(cherry picked from commit b9969ef)
  • Loading branch information
gsmet committed Jan 4, 2023
1 parent b84956f commit 1499d1c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import org.hibernate.validator.metadata.BeanMetaDataClassNormalizer;

import io.quarkus.arc.ClientProxy;
import io.quarkus.arc.Subclass;

/**
* In the case of a proxy generated by Arc, return the parent class.
* <br />
* This can have more than one level of hierarchy, in example:
* This can have more than one level of hierarchy, for example:
* <ul>
* <li>When using @{@link io.quarkus.test.junit.mockito.InjectMock} or @{@link io.quarkus.test.junit.mockito.InjectSpy}</li>
* </ul>
Expand All @@ -20,6 +21,9 @@ public <T> Class<? super T> normalize(Class<T> beanClass) {
while (Subclass.class.isAssignableFrom(targetClass)) {
targetClass = targetClass.getSuperclass();
}
while (ClientProxy.class.isAssignableFrom(targetClass)) {
targetClass = targetClass.getSuperclass();
}
return targetClass;
}

Expand Down

0 comments on commit 1499d1c

Please sign in to comment.