Issue Type: Improvement Improvement
Affects Versions: 5.0.0.CR3
Assignee: Unassigned
Components: engine
Created: 16/Mar/13 7:45 PM
Description:

Weld creates proxy sub-classes for intercepted classes, re-declaring any annotations declared on the proxied super-class. For return values marked for cascaded validation this causes an exception because a return value must not be marked more than once as cascaded per hierarchy line:

javax.validation.ConstraintDeclarationException: HV000131: A method return value must not be marked for cascaded validation more than once in a class hierarchy, but the following two methods are marked as such: public org.hibernate.beanvalidation.tck.tests.integration.cdi.executable.Event org.hibernate.beanvalidation.tck.tests.integration.cdi.executable.CalendarService$Proxy$_$$_WeldSubclass.createValidEvent(), public org.hibernate.beanvalidation.tck.tests.integration.cdi.executable.Event org.hibernate.beanvalidation.tck.tests.integration.cdi.executable.CalendarService.createValidEvent().
	at org.hibernate.validator.internal.metadata.aggregated.rule.ReturnValueMayOnlyBeMarkedOnceAsCascadedPerHierarchyLine.apply(ReturnValueMayOnlyBeMarkedOnceAsCascadedPerHierarchyLine.java:33)
	at org.hibernate.validator.internal.metadata.aggregated.ExecutableMetaData$Builder.assertCorrectnessOfConfiguration(ExecutableMetaData.java:443)
	at org.hibernate.validator.internal.metadata.aggregated.ExecutableMetaData$Builder.build(ExecutableMetaData.java:361)

For parameter constraints we circumvented the problem by checking whether any constraints on overriding methods resemble the constraints on the supertype method. For return values this can't be done in the same way, since there is an explicit TCK test expecting an exception when a return value is marked as cascaded several times. The only way I see around this is to try to detect proxy classes and ignore any cascaded markers on them.

Fix Versions: 5.0.0.CR4
Project: Hibernate Validator
Priority: Major Major
Reporter: Gunnar Morling
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira