Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HV-1494 hibernate validator error when @NotEmpty used on return type #862

Closed
wants to merge 1 commit into from

Conversation

marko-bekhta
Copy link
Member

@marko-bekhta marko-bekhta commented Oct 18, 2017

Previous implementation were not giving a chance for composite constraints to execute if they were placed on a method with non void return type and parameters - as for those both hasGenericValidators and hasCrossParameterValidator were false and there's no way to set validationAppliesTo so ConstraintDescriptorImpl#determineConstraintType was just skipping to:

// Now we are out of luck
if ( constraintType == null ) {
  throw LOG.getImplicitConstraintTargetInAmbiguousConfigurationException( annotationType );
}

hence there was no way to use them on methods with both return value and parameters....

Let me know what you think about these changes :)

Previous implementation were not giving a chance for composite constraints
to execute if they were placed on a method with non void return type and
parameters
@marko-bekhta
Copy link
Member Author

marko-bekhta commented Oct 18, 2017

@gsmet sooo you were asking about this one in JIRA. Here's what I have atm.
Upd.: just saw Gunnar's comment on SO about @SupportedValidationTarget(ValidationTarget.ANNOTATED_ELEMENT) ... I've probably over complicated the fix :)

@marko-bekhta
Copy link
Member Author

closing this one in favor of #863

if ( constraintType == null ) {
throw LOG.getImplicitConstraintTargetInAmbiguousConfigurationException( annotationType );
// check if it's a composite constraint and is built with constraints for which a type can be detected
Set<ConstraintType> constraintTypes = findComposingConstraints( constraintHelper )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already call parseComposingConstraints(); could we somehow combine this, instead of running the annotation tree another time?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll see what can be done about it and open another PR if something good comes out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants