Skip to content

Commit 4bedfc5

Browse files
committed
HV-1591 Log a warning for improper use of Valid annotation
1 parent a8664fd commit 4bedfc5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

engine/src/main/java/org/hibernate/validator/internal/metadata/aggregated/CascadingMetaDataBuilder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ public CascadingMetaData build(ValueExtractorManager valueExtractorManager, Obje
224224
Set<ValueExtractorDescriptor> containerDetectionValueExtractorCandidates = valueExtractorManager.getResolver()
225225
.getValueExtractorCandidatesForContainerDetectionOfGlobalCascadedValidation( enclosingType );
226226
if ( !containerDetectionValueExtractorCandidates.isEmpty() ) {
227+
// Using @Valid on a container is deprecated at the moment. You are supposed to apply the annotation on the type argument(s).
228+
LOG.deprecatedUseOfValidOnContainer( ReflectionHelper.getClassFromType( enclosingType ), context );
229+
227230
if ( containerDetectionValueExtractorCandidates.size() > 1 ) {
228231
throw LOG.getUnableToGetMostSpecificValueExtractorDueToSeveralMaximallySpecificValueExtractorsDeclaredException(
229232
ReflectionHelper.getClassFromType( enclosingType ),

0 commit comments

Comments
 (0)