Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -666,11 +666,27 @@ private Map<TypeVariable<?>, CascadingMetaDataBuilder> getTypeParametersCascadin
else if ( annotatedType instanceof AnnotatedParameterizedType ) {
return getTypeParametersCascadingMetaDataForParameterizedType( (AnnotatedParameterizedType) annotatedType, typeParameters );
}
else if ( typeParameters.length > 0 ) {
return getTypeParametersCascadingMetaDataForParameterizedType( annotatedType, typeParameters );
}
else {
return Collections.emptyMap();
}
}

private Map<TypeVariable<?>, CascadingMetaDataBuilder> getTypeParametersCascadingMetaDataForParameterizedType(AnnotatedType annotatedType, TypeVariable<?>[] typeParameters) {
// We did not get the parameterized (annotated) type but a raw one instead. (because we have the type variables)
// There won't be any cascading on the type variables since ... it's a raw type so we just create a placeholder instead:
Map<TypeVariable<?>, CascadingMetaDataBuilder> typeParametersCascadingMetadata = CollectionHelper.newHashMap( typeParameters.length );

for ( TypeVariable<?> typeParameter : typeParameters ) {
typeParametersCascadingMetadata.put( typeParameter, new CascadingMetaDataBuilder( annotatedType.getType(), typeParameter,
false, Map.of(), Map.of() ) );
}

return typeParametersCascadingMetadata;
}

private Map<TypeVariable<?>, CascadingMetaDataBuilder> getTypeParametersCascadingMetaDataForParameterizedType(
AnnotatedParameterizedType annotatedParameterizedType, TypeVariable<?>[] typeParameters) {
Map<TypeVariable<?>, CascadingMetaDataBuilder> typeParametersCascadingMetadata = CollectionHelper.newHashMap( typeParameters.length );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
public class ValidatorFactoryBeanMetadataClassNormalizerTest {

@Test(expectedExceptions = ValidationException.class,
expectedExceptionsMessageRegExp = ".*No suitable value extractor found for type interface java.util.List.*")
expectedExceptionsMessageRegExp = ".*No validator could be found for constraint 'jakarta.validation.constraints.Email' validating type 'java.lang.Object'.*")
public void testBeanMetaDataClassNormalizerNoNormalizer() throws NoSuchMethodException {
ValidatorFactory validatorFactory = Validation.byDefaultProvider()
.configure()
Expand Down Expand Up @@ -110,6 +110,8 @@ public <T> Class<? super T> normalize(Class<T> beanClass) {
private static class BeanProxy extends Bean implements MyProxyInterface {
// The proxy dropped the generics, but kept constraint annotations,
// which will cause trouble unless its metadata is ignored.
// We won't be able to find a suitable constraint validator for email
// since we will be looking for an impl for the `Object`.
@Override
@SuppressWarnings("unchecked")
public void setEmails(@Email(payload = Unwrapping.Unwrap.class) List emails) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
These dependencies should be aligned with the ones from the WildFly version we support
See http://search.maven.org/#search|gav|1|g%3A"org.wildfly"%20AND%20a%3A"wildfly-parent"
-->
<version.com.fasterxml.classmate>1.7.1</version.com.fasterxml.classmate>
<version.com.fasterxml.classmate>1.7.3</version.com.fasterxml.classmate>
<version.joda-time>2.14.0</version.joda-time>
<version.org.slf4j>2.0.17</version.org.slf4j>
<version.org.apache.logging.log4j>2.25.3</version.org.apache.logging.log4j>
Expand Down