TCK: do nothing with non-constrained properties
Project: http://git-wip-us.apache.org/repos/asf/bval/repo Commit: http://git-wip-us.apache.org/repos/asf/bval/commit/7a332de0 Tree: http://git-wip-us.apache.org/repos/asf/bval/tree/7a332de0 Diff: http://git-wip-us.apache.org/repos/asf/bval/diff/7a332de0 Branch: refs/heads/master Commit: 7a332de00e377441a6676bee90f466819d8b741f Parents: 15a3e2b Author: Matt Benson <mben...@apache.org> Authored: Thu Mar 29 18:18:59 2018 -0500 Committer: Matt Benson <mben...@apache.org> Committed: Tue Oct 16 12:28:20 2018 -0500 ---------------------------------------------------------------------- .../java/org/apache/bval/jsr/job/ValidateProperty.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bval/blob/7a332de0/bval-jsr/src/main/java/org/apache/bval/jsr/job/ValidateProperty.java ---------------------------------------------------------------------- diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/job/ValidateProperty.java b/bval-jsr/src/main/java/org/apache/bval/jsr/job/ValidateProperty.java index 11b6338..9dd4f5c 100644 --- a/bval-jsr/src/main/java/org/apache/bval/jsr/job/ValidateProperty.java +++ b/bval-jsr/src/main/java/org/apache/bval/jsr/job/ValidateProperty.java @@ -48,6 +48,7 @@ import org.apache.bval.jsr.descriptor.CascadableContainerD; import org.apache.bval.jsr.descriptor.ComposedD; import org.apache.bval.jsr.descriptor.ConstraintD; import org.apache.bval.jsr.descriptor.ContainerElementTypeD; +import org.apache.bval.jsr.descriptor.DescriptorManager; import org.apache.bval.jsr.descriptor.ElementD; import org.apache.bval.jsr.descriptor.PropertyD; import org.apache.bval.jsr.metadata.ContainerElementKey; @@ -476,7 +477,7 @@ public final class ValidateProperty<T> extends ValidationJob<T> { t = value.getClass(); } descriptor = (ElementD<?, ?>) validatorContext.getDescriptorManager().getBeanDescriptor(t); - } else { + } else if (hasWork()) { final Class<?> propertyType = descriptor.getElementClass(); if (!TypeUtils.isInstance(value, propertyType)) { Exceptions.raise(IllegalArgumentException::new, "%s is not an instance of %s", value, propertyType); @@ -503,7 +504,6 @@ public final class ValidateProperty<T> extends ValidationJob<T> { @Override protected Frame<?> computeBaseFrame() { // TODO assign bean as its own property and figure out what to do - return strategy.frame(this, propertyPath); } @@ -513,6 +513,14 @@ public final class ValidateProperty<T> extends ValidationJob<T> { } @Override + protected boolean hasWork() { + if (descriptor instanceof BeanDescriptor) { + return ((BeanDescriptor) descriptor).isBeanConstrained(); + } + return DescriptorManager.isConstrained((PropertyDescriptor) descriptor); + } + + @Override ConstraintViolationImpl<T> createViolation(String messageTemplate, String message, ConstraintValidatorContextImpl<T> context, PathImpl propertyPath) { return new ConstraintViolationImpl<>(messageTemplate, message, rootBean, context.getFrame().getBean(),