bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject [21/50] bval git commit: correctly handle IMPLICIT constraintTarget
Date Tue, 16 Oct 2018 17:35:22 GMT
correctly handle IMPLICIT constraintTarget


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

Branch: refs/heads/master
Commit: 963ac52b122dfa55bd71fa36dbc420629455a836
Parents: 54dab69
Author: Matt Benson <mbenson@apache.org>
Authored: Tue Apr 3 16:49:25 2018 -0500
Committer: Matt Benson <mbenson@apache.org>
Committed: Tue Oct 16 12:28:20 2018 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/bval/jsr/descriptor/ConstraintD.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bval/blob/963ac52b/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/ConstraintD.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/ConstraintD.java b/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/ConstraintD.java
index a8f95ed..494002b 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/ConstraintD.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/ConstraintD.java
@@ -240,7 +240,7 @@ public class ConstraintD<A extends Annotation> implements ConstraintDescriptor<A
 
     private ConstraintTarget computeValidationAppliesTo(ElementType elementType) {
         final ConstraintTarget result = read(ConstraintAnnotationAttributes.VALIDATION_APPLIES_TO);
-        if (result != null) {
+        if (result != null && result != ConstraintTarget.IMPLICIT) {
             final AnnotatedElement host = meta.getHost();
             Exceptions.raiseUnless(host instanceof Executable, ConstraintDeclarationException::new,
"Illegal %s on %s",
                 result, host);
@@ -254,9 +254,9 @@ public class ConstraintD<A extends Annotation> implements ConstraintDescriptor<A
                 Exceptions.raiseIf(Void.TYPE.equals(meta.getType()), ConstraintDeclarationException::new,
                     "Illegal %s on %s method %s", result, Void.TYPE, host);
                 break;
-            case IMPLICIT:
-                // handled in ReflectionBuilder
             default:
+                Exceptions.raise(IllegalStateException::new, "Unknown %s %s", ConstraintTarget.class.getSimpleName(),
+                    result);
             }
         }
         return result;


Mime
View raw message