bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject [27/50] bval git commit: ignore group conversions without cascade on property getters
Date Tue, 16 Oct 2018 17:35:28 GMT
ignore group conversions without cascade on property getters


Project: http://git-wip-us.apache.org/repos/asf/bval/repo
Commit: http://git-wip-us.apache.org/repos/asf/bval/commit/cc8a72c7
Tree: http://git-wip-us.apache.org/repos/asf/bval/tree/cc8a72c7
Diff: http://git-wip-us.apache.org/repos/asf/bval/diff/cc8a72c7

Branch: refs/heads/master
Commit: cc8a72c72011ae51cedd99e1a61b273aa506ec43
Parents: 99c0079
Author: Matt Benson <mbenson@apache.org>
Authored: Thu Apr 12 18:27:53 2018 -0500
Committer: Matt Benson <mbenson@apache.org>
Committed: Tue Oct 16 12:28:20 2018 -0500

----------------------------------------------------------------------
 .../java/org/apache/bval/jsr/descriptor/MetadataReader.java     | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bval/blob/cc8a72c7/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/MetadataReader.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/MetadataReader.java b/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/MetadataReader.java
index 112aa81..ec4fc66 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/MetadataReader.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/MetadataReader.java
@@ -19,6 +19,7 @@
 package org.apache.bval.jsr.descriptor;
 
 import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
 import java.lang.reflect.AnnotatedElement;
 import java.lang.reflect.AnnotatedType;
 import java.lang.reflect.Constructor;
@@ -293,6 +294,10 @@ class MetadataReader {
             final Set<GroupConversion> groupConversions = builder.getGroupConversions(meta);
             if (!groupConversions.isEmpty()) {
                 if (!isCascaded()) {
+                    // ignore group conversions without cascade on property getters:
+                    if (meta.getElementType() == ElementType.METHOD && Methods.isGetter((Method)
meta.getHost())) {
+                        return Collections.emptySet();
+                    }
                     Exceptions.raise(ConstraintDeclarationException::new, "@%s declared without
@%s on %s",
                         ConvertGroup.class.getSimpleName(), Valid.class.getSimpleName(),
meta.describeHost());
                 }


Mime
View raw message