Skip to content

Commit 322288d

Browse files
marko-bekhtagsmet
authored andcommitted
HV-1470 Switching to warning instead of error when validatedBy is empty
1 parent ecbfc5c commit 322288d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

annotation-processor/src/main/java/org/hibernate/validator/ap/internal/checks/ConstraintValidatorCheck.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public Set<ConstraintCheckIssue> checkAnnotationType(TypeElement element, Annota
4747
if ( !( atLeastOneValidatorGiven || constraintHelper.isComposedConstraint( element ) ) ) {
4848

4949
return CollectionHelper.asSet(
50-
ConstraintCheckIssue.error(
50+
ConstraintCheckIssue.warning(
5151
element,
5252
constraintMirror,
5353
"CONSTRAINT_TYPE_WITHOUT_VALIDATOR"

annotation-processor/src/main/resources/org/hibernate/validator/ap/ValidationProcessorMessages.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ATVALID_NOT_ALLOWED_AT_PRIMITIVE_FIELD=Fields of a primitive type must not annot
1212
ATVALID_NOT_ALLOWED_AT_METHOD_RETURNING_PRIMITIVE_TYPE=Methods returning a primitive type must not annotated with @Valid.
1313
CONSTRAINT_TYPE_WITH_MISSING_OR_WRONG_RETENTION=Constraint annotation types must be annotated with @Retention(RUNTIME).
1414
CONSTRAINT_TYPE_WITH_WRONG_TARGET=Constraint annotation types must have at least one of the element types FIELD, METHOD, TYPE or ANNOTATION_TYPE as target.
15-
CONSTRAINT_TYPE_WITHOUT_VALIDATOR=For non-composed constraints a validator implementation must be specified using @Constraint#validatedBy().
15+
CONSTRAINT_TYPE_WITHOUT_VALIDATOR=No constraint validators are declared in the 'validatedBy()' attribute of the constraint declaration, make sure that they are declared either programmatically, in the XML configuration or via the service loader.
1616
CONSTRAINT_TYPE_MUST_DECLARE_MESSAGE_MEMBER=Constraint annotation types must declare a member 'String message()'.
1717
RETURN_TYPE_MUST_BE_STRING=Return type of constraint annotation type member 'message()' must be 'String'.
1818
CONSTRAINT_TYPE_MUST_DECLARE_GROUPS_MEMBER=Constraint annotation types must declare a member 'Class<?>[] groups() default {}'.

annotation-processor/src/test/java/org/hibernate/validator/ap/AnnotationTypeValidationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ public void testThatConstraintAnnotationTypeWithoutValidatorCausesCompilationErr
104104
boolean compilationResult =
105105
compilerHelper.compile( new ConstraintValidationProcessor(), diagnostics, sourceFile1, sourceFile2 );
106106

107-
assertFalse( compilationResult );
107+
assertTrue( compilationResult );
108108
assertThatDiagnosticsMatch(
109109
diagnostics,
110-
new DiagnosticExpectation( Kind.ERROR, 24 )
110+
new DiagnosticExpectation( Kind.WARNING, 24 )
111111
);
112112
}
113113

0 commit comments

Comments
 (0)