bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1793432 [2/5] - in /bval/branches/bv2.x: ./ bval-core/src/main/java/org/apache/bval/ bval-core/src/main/java/org/apache/bval/model/ bval-core/src/main/java/org/apache/bval/routines/ bval-core/src/main/java/org/apache/bval/util/ bval-core/s...
Date Tue, 02 May 2017 04:53:22 GMT
Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffValidator.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffValidator.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffValidator.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffValidator.java Tue May  2 04:53:20 2017
@@ -33,7 +33,7 @@ import static java.lang.Character.getNum
  * See <a href="http://en.wikipedia.org/wiki/Verhoeff_algorithm">Wikipedia
  *  - Verhoeff algorithm</a> for more details.
  */
-public final class VerhoeffValidator implements ConstraintValidator<Verhoeff, String> {
+public final class VerhoeffValidator implements ConstraintValidator<Verhoeff, CharSequence> {
 
     //@formatter:off
     /** D - multiplication table */
@@ -65,7 +65,7 @@ public final class VerhoeffValidator imp
      * {@inheritDoc}
      */
     @Override
-    public boolean isValid(String code, ConstraintValidatorContext context) {
+    public boolean isValid(CharSequence code, ConstraintValidatorContext context) {
         if (code.length() == 0) {
             return false;
         }

Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java Tue May  2 04:53:20 2017
@@ -28,7 +28,9 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
 
 import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
 import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
 import static java.lang.annotation.ElementType.PARAMETER;
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
 
@@ -45,7 +47,7 @@ import static java.lang.annotation.Reten
 @Luhn
 @Pattern(regexp = "^(3[47]\\d{13})$")
 @Constraint(validatedBy = {})
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface AmericanExpress {
 

Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java Tue May  2 04:53:20 2017
@@ -28,7 +28,9 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
 
 import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
 import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
 import static java.lang.annotation.ElementType.PARAMETER;
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
 
@@ -45,7 +47,7 @@ import static java.lang.annotation.Reten
 @Luhn
 @Pattern(regexp = "^(30[0-5]\\d{11}|3095\\d{10}|36\\d{12}|3[8-9]\\d{12})$")
 @Constraint(validatedBy = {})
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface Diners {
 

Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java Tue May  2 04:53:20 2017
@@ -28,7 +28,9 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
 
 import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
 import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
 import static java.lang.annotation.ElementType.PARAMETER;
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
 
@@ -45,7 +47,7 @@ import static java.lang.annotation.Reten
 @Luhn
 @Pattern(regexp = "^((6011\\d{12})|(64[4-9]\\d{13})|(65\\d{14}))$")
 @Constraint(validatedBy = {})
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface Discover {
 

Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java Tue May  2 04:53:20 2017
@@ -28,7 +28,9 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
 
 import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
 import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
 import static java.lang.annotation.ElementType.PARAMETER;
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
 
@@ -45,7 +47,7 @@ import static java.lang.annotation.Reten
 @Luhn
 @Pattern(regexp = "^(5[1-5]\\d{14})$")
 @Constraint(validatedBy = {})
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface Mastercard {
 

Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/DirectoryValidator.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/DirectoryValidator.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/DirectoryValidator.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/DirectoryValidator.java Tue May  2 04:53:20 2017
@@ -32,7 +32,7 @@ public class DirectoryValidator implemen
      */
     @Override
     public boolean isValid(File value, ConstraintValidatorContext context) {
-        return value.exists() && value.isDirectory();
+        return value.isDirectory();
     }
 
     /**

Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/SymlinkValidator.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/SymlinkValidator.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/SymlinkValidator.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/SymlinkValidator.java Tue May  2 04:53:20 2017
@@ -49,7 +49,7 @@ public class SymlinkValidator implements
         }
 
         try {
-            File fileInCanonicalDir = null;
+            File fileInCanonicalDir;
             if (value.getParent() == null) {
                 fileInCanonicalDir = value;
             } else {

Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/DomainValidator.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/DomainValidator.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/DomainValidator.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/DomainValidator.java Tue May  2 04:53:20 2017
@@ -20,11 +20,12 @@ package org.apache.bval.extras.constrain
 
 import javax.validation.ConstraintValidator;
 import javax.validation.ConstraintValidatorContext;
-import java.util.List;
+import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import static java.util.Arrays.asList;
+import java.util.Arrays;
+import java.util.HashSet;
 
 /**
  * <p><b>Domain name</b> validation routines.</p>
@@ -63,7 +64,7 @@ import static java.util.Arrays.asList;
  * {@link java.net.InetAddress} for that functionality.)
  * </p>
  */
-public class DomainValidator implements ConstraintValidator<Domain, String> {
+public class DomainValidator implements ConstraintValidator<Domain, CharSequence> {
 
     private boolean allowLocal;
 
@@ -77,15 +78,13 @@ public class DomainValidator implements
      * {@inheritDoc}
      */
     @Override
-    public boolean isValid(String domain, ConstraintValidatorContext context) {
+    public boolean isValid(CharSequence domain, ConstraintValidatorContext context) {
         Matcher matcher = DOMAIN_NAME_REGEX.matcher(domain);
         if (matcher.matches()) {
             domain = matcher.group(1);
-            return isValidTld(domain);
-        } else if (allowLocal && DOMAIN_LABEL.matcher(domain).matches()) {
-            return true;
+            return isValidTld(domain.toString());
         }
-        return false;
+        return allowLocal && DOMAIN_LABEL.matcher(domain).matches();
     }
 
     /**
@@ -154,7 +153,7 @@ public class DomainValidator implements
     }
 
     private static String chompLeadingDot(String str) {
-        if (str.startsWith(".")) {
+        if (str.charAt(0) == '.') {
             return str.substring(1);
         }
         return str;
@@ -165,11 +164,11 @@ public class DomainValidator implements
     // ----- Authoritative and comprehensive list at:
     // ----- http://data.iana.org/TLD/tlds-alpha-by-domain.txt
 
-    private static final List<String> INFRASTRUCTURE_TLDS = asList("arpa", // internet infrastructure
+    private static final Set<String> INFRASTRUCTURE_TLDS = new HashSet<>(Arrays.asList("arpa", // internet infrastructure
         "root" // diagnostic marker for non-truncated root zone
-    );
+    ));
 
-    private static final List<String> GENERIC_TLDS = asList("aero", // air transport industry
+    private static final Set<String> GENERIC_TLDS = new HashSet<>(Arrays.asList("aero", // air transport industry
         "asia", // Pan-Asia/Asia Pacific
         "biz", // businesses
         "cat", // Catalan linguistic/cultural community
@@ -189,9 +188,9 @@ public class DomainValidator implements
         "edu", // accredited postsecondary US education entities
         "mil", // United States Military
         "int" // organizations established by international treaty
-    );
+    ));
 
-    private static final List<String> COUNTRY_CODE_TLDS = asList("ac", // Ascension Island
+    private static final Set<String> COUNTRY_CODE_TLDS = new HashSet<>(Arrays.asList("ac", // Ascension Island
         "ad", // Andorra
         "ae", // United Arab Emirates
         "af", // Afghanistan
@@ -440,11 +439,11 @@ public class DomainValidator implements
         "za", // South Africa
         "zm", // Zambia
         "zw" // Zimbabwe
-    );
+    ));
 
-    private static final List<String> LOCAL_TLDS = asList("localhost", // RFC2606 defined
+    private static final Set<String> LOCAL_TLDS = new HashSet<>(Arrays.asList("localhost", // RFC2606 defined
         "localdomain" // Also widely used as localhost.localdomain
-    );
+    ));
 
     /**
      * {@inheritDoc}

Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/InetAddressValidator.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/InetAddressValidator.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/InetAddressValidator.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/InetAddressValidator.java Tue May  2 04:53:20 2017
@@ -27,7 +27,7 @@ import java.util.regex.Pattern;
  *
  * <p>This class provides methods to validate a candidate IP address.
  */
-public class InetAddressValidator implements ConstraintValidator<InetAddress, String> {
+public class InetAddressValidator implements ConstraintValidator<InetAddress, CharSequence> {
 
     private static final Pattern IPV4_PATTERN =
         Pattern.compile("^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\."
@@ -37,7 +37,7 @@ public class InetAddressValidator implem
      * {@inheritDoc}
      */
     @Override
-    public boolean isValid(String value, ConstraintValidatorContext context) {
+    public boolean isValid(CharSequence value, ConstraintValidatorContext context) {
         if (!IPV4_PATTERN.matcher(value).matches()) {
             return false;
         }

Modified: bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ABANumberValidatorTest.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ABANumberValidatorTest.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ABANumberValidatorTest.java (original)
+++ bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ABANumberValidatorTest.java Tue May  2 04:53:20 2017
@@ -25,7 +25,7 @@ import java.lang.annotation.Annotation;
 public class ABANumberValidatorTest extends AbstractCheckDigitTest {
 
     @Override
-    protected ConstraintValidator<? extends Annotation, String> getConstraint() {
+    protected ConstraintValidator<? extends Annotation, ? super String> getConstraint() {
         return new ABANumberValidator();
     }
 

Modified: bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/AbstractCheckDigitTest.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/AbstractCheckDigitTest.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/AbstractCheckDigitTest.java (original)
+++ bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/AbstractCheckDigitTest.java Tue May  2 04:53:20 2017
@@ -37,7 +37,7 @@ public abstract class AbstractCheckDigit
     private int checkDigitLth;
 
     /** Check digit routine being tested */
-    private ConstraintValidator<? extends Annotation, String> routine;
+    private ConstraintValidator<? extends Annotation, ? super String> routine;
 
     /** Array of valid code values */
     private String[] valid;
@@ -55,7 +55,7 @@ public abstract class AbstractCheckDigit
         return 1;
     }
 
-    protected abstract ConstraintValidator<? extends Annotation, String> getConstraint();
+    protected abstract ConstraintValidator<? extends Annotation, ? super String> getConstraint();
 
     protected abstract String[] getValid();
 

Modified: bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/CUSIPValidatorTest.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/CUSIPValidatorTest.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/CUSIPValidatorTest.java (original)
+++ bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/CUSIPValidatorTest.java Tue May  2 04:53:20 2017
@@ -25,7 +25,7 @@ import java.lang.annotation.Annotation;
 public class CUSIPValidatorTest extends AbstractCheckDigitTest {
 
     @Override
-    protected ConstraintValidator<? extends Annotation, String> getConstraint() {
+    protected ConstraintValidator<? extends Annotation, ? super String> getConstraint() {
         return new CUSIPValidator();
     }
 

Modified: bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/EAN13CheckDigitTest.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/EAN13CheckDigitTest.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/EAN13CheckDigitTest.java (original)
+++ bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/EAN13CheckDigitTest.java Tue May  2 04:53:20 2017
@@ -25,7 +25,7 @@ import java.lang.annotation.Annotation;
 public class EAN13CheckDigitTest extends AbstractCheckDigitTest {
 
     @Override
-    protected ConstraintValidator<? extends Annotation, String> getConstraint() {
+    protected ConstraintValidator<? extends Annotation, ? super String> getConstraint() {
         return new EAN13Validator();
     }
 

Modified: bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/IBANCheckDigitTest.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/IBANCheckDigitTest.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/IBANCheckDigitTest.java (original)
+++ bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/IBANCheckDigitTest.java Tue May  2 04:53:20 2017
@@ -35,7 +35,7 @@ public class IBANCheckDigitTest extends
     }
 
     @Override
-    protected ConstraintValidator<? extends Annotation, String> getConstraint() {
+    protected ConstraintValidator<? extends Annotation, ? super String> getConstraint() {
         return new IBANValidator();
     }
 

Modified: bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ISBN10CheckDigitTest.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ISBN10CheckDigitTest.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ISBN10CheckDigitTest.java (original)
+++ bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ISBN10CheckDigitTest.java Tue May  2 04:53:20 2017
@@ -25,7 +25,7 @@ import java.lang.annotation.Annotation;
 public class ISBN10CheckDigitTest extends AbstractCheckDigitTest {
 
     @Override
-    protected ConstraintValidator<? extends Annotation, String> getConstraint() {
+    protected ConstraintValidator<? extends Annotation, ? super String> getConstraint() {
         return new ISBN10Validator();
     }
 

Modified: bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/LuhnCheckDigitTest.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/LuhnCheckDigitTest.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/LuhnCheckDigitTest.java (original)
+++ bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/LuhnCheckDigitTest.java Tue May  2 04:53:20 2017
@@ -37,7 +37,7 @@ public class LuhnCheckDigitTest extends
     private static final String VALID_DINERS     = "30569309025904";
 
     @Override
-    protected ConstraintValidator<? extends Annotation, String> getConstraint() {
+    protected ConstraintValidator<? extends Annotation, ? super String> getConstraint() {
         return new LuhnValidator();
     }
 

Modified: bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/SedolCheckDigitTest.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/SedolCheckDigitTest.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/SedolCheckDigitTest.java (original)
+++ bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/SedolCheckDigitTest.java Tue May  2 04:53:20 2017
@@ -25,7 +25,7 @@ import java.lang.annotation.Annotation;
 public class SedolCheckDigitTest extends AbstractCheckDigitTest {
 
     @Override
-    protected ConstraintValidator<? extends Annotation, String> getConstraint() {
+    protected ConstraintValidator<? extends Annotation, ? super String> getConstraint() {
         return new SedolValidator();
     }
 

Modified: bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffCheckDigitTest.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffCheckDigitTest.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffCheckDigitTest.java (original)
+++ bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffCheckDigitTest.java Tue May  2 04:53:20 2017
@@ -28,7 +28,7 @@ import java.lang.annotation.Annotation;
 public class VerhoeffCheckDigitTest extends AbstractCheckDigitTest {
 
     @Override
-    protected ConstraintValidator<? extends Annotation, String> getConstraint() {
+    protected ConstraintValidator<? extends Annotation, ? super String> getConstraint() {
         return new VerhoeffValidator();
     }
 

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/AnyLiteral.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/AnyLiteral.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/AnyLiteral.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/AnyLiteral.java Tue May  2 04:53:20 2017
@@ -19,7 +19,6 @@
 package org.apache.bval.cdi;
 
 import javax.enterprise.inject.Any;
-import javax.enterprise.util.AnnotationLiteral;
 
 public class AnyLiteral extends EmptyAnnotationLiteral<Any> implements Any {
     private static final long serialVersionUID = 1L;
@@ -31,7 +30,7 @@ public class AnyLiteral extends EmptyAnn
 
     @Override
     public String toString() {
-        return "@javax.enterprise.inject.Any()";
+        return String.format("@%s()", Any.class.getName());
     }
 
 }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValAnnotatedType.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValAnnotatedType.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValAnnotatedType.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValAnnotatedType.java Tue May  2 04:53:20 2017
@@ -18,17 +18,16 @@
  */
 package org.apache.bval.cdi;
 
-import javax.enterprise.inject.spi.AnnotatedConstructor;
-import javax.enterprise.inject.spi.AnnotatedField;
-import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.util.AnnotationLiteral;
-
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 import java.util.HashSet;
 import java.util.Set;
 
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+
 public class BValAnnotatedType<A> implements AnnotatedType<A> {
     private final AnnotatedType<A> delegate;
     private final Set<Annotation> annotations;
@@ -36,8 +35,7 @@ public class BValAnnotatedType<A> implem
     public BValAnnotatedType(final AnnotatedType<A> annotatedType) {
         delegate = annotatedType;
 
-        annotations = new HashSet<Annotation>(annotatedType.getAnnotations().size());
-        annotations.addAll(annotatedType.getAnnotations());
+        annotations = new HashSet<>(annotatedType.getAnnotations());
         annotations.add(BValBindingLiteral.INSTANCE);
     }
 
@@ -73,14 +71,8 @@ public class BValAnnotatedType<A> implem
 
     @Override
     public <T extends Annotation> T getAnnotation(final Class<T> annotationType) {
-        for (final Annotation ann : annotations) {
-            if (ann.annotationType().equals(annotationType)) {
-                @SuppressWarnings("unchecked")
-                final T result = (T) ann;
-                return result;
-            }
-        }
-        return null;
+        return annotations.stream().filter(ann -> ann.annotationType().equals(annotationType)).map(annotationType::cast)
+            .findFirst().orElse(null);
     }
 
     @Override
@@ -90,12 +82,7 @@ public class BValAnnotatedType<A> implem
 
     @Override
     public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
-        for (final Annotation ann : annotations) {
-            if (ann.annotationType().equals(annotationType)) {
-                return true;
-            }
-        }
-        return false;
+        return annotations.stream().anyMatch(ann -> ann.annotationType().equals(annotationType));
     }
 
     public static class BValBindingLiteral extends EmptyAnnotationLiteral<BValBinding> implements BValBinding {
@@ -105,7 +92,7 @@ public class BValAnnotatedType<A> implem
 
         @Override
         public String toString() {
-            return "@org.apache.bval.cdi.BValBinding()";
+            return String.format("@%s()", BValBinding.class.getName());
         }
 
     }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java Tue May  2 04:53:20 2017
@@ -59,13 +59,7 @@ import org.apache.bval.util.Validate;
 public class BValExtension implements Extension {
     private static final Logger LOGGER = Logger.getLogger(BValExtension.class.getName());
 
-    private static final AnnotatedTypeFilter DEFAULT_ANNOTATED_TYPE_FILTER = new AnnotatedTypeFilter() {
-
-        @Override
-        public boolean accept(AnnotatedType<?> annotatedType) {
-            return !annotatedType.getJavaClass().getName().startsWith("org.apache.bval.");
-        }
-    };
+    private static final AnnotatedTypeFilter DEFAULT_ANNOTATED_TYPE_FILTER = annotatedType -> !annotatedType.getJavaClass().getName().startsWith("org.apache.bval.");
 
     private static AnnotatedTypeFilter annotatedTypeFilter = DEFAULT_ANNOTATED_TYPE_FILTER;
 
@@ -183,8 +177,7 @@ public class BValExtension implements Ex
                                 && !classConstraints.getConstrainedMethods(MethodType.NON_GETTER).isEmpty()
                             || validGetterMethods
                                 && !classConstraints.getConstrainedMethods(MethodType.GETTER).isEmpty())) {
-                        final BValAnnotatedType<A> bValAnnotatedType = new BValAnnotatedType<A>(annotatedType);
-                        pat.setAnnotatedType(bValAnnotatedType);
+                        pat.setAnnotatedType(new BValAnnotatedType<A>(annotatedType));
                     }
                 } catch (final NoClassDefFoundError ncdfe) {
                     // skip
@@ -199,12 +192,7 @@ public class BValExtension implements Ex
 
     private static <A> boolean hasValidationAnnotation(
         final Collection<? extends AnnotatedCallable<? super A>> methods) {
-        for (final AnnotatedCallable<? super A> m : methods) {
-            if (m.isAnnotationPresent(ValidateOnExecution.class)) {
-                return true;
-            }
-        }
-        return false;
+        return methods.stream().anyMatch(m -> m.isAnnotationPresent(ValidateOnExecution.class));
     }
 
     public <A> void processBean(final @Observes ProcessBean<A> processBeanEvent) {

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptor.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptor.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptor.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptor.java Tue May  2 04:53:20 2017
@@ -18,8 +18,7 @@
  */
 package org.apache.bval.cdi;
 
-import org.apache.bval.jsr.util.ClassHelper;
-import org.apache.bval.jsr.util.Proxies;
+import static java.util.Arrays.asList;
 
 import java.io.Serializable;
 import java.lang.reflect.Constructor;
@@ -33,6 +32,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+
 import javax.annotation.Priority;
 import javax.enterprise.inject.spi.AnnotatedConstructor;
 import javax.enterprise.inject.spi.AnnotatedMethod;
@@ -53,18 +53,20 @@ import javax.validation.executable.Valid
 import javax.validation.metadata.ConstructorDescriptor;
 import javax.validation.metadata.MethodDescriptor;
 
-import static java.util.Arrays.asList;
+import org.apache.bval.jsr.util.ClassHelper;
+import org.apache.bval.jsr.util.Proxies;
 
 /**
  * Interceptor class for the {@link BValBinding} {@link InterceptorBinding}.
  */
+@SuppressWarnings("serial")
 @Interceptor
 @BValBinding
 @Priority(4800)
 // TODO: maybe add it through ASM to be compliant with CDI 1.0 containers using simply this class as a template to
 // generate another one for CDI 1.1 impl
 public class BValInterceptor implements Serializable {
-    private transient volatile Map<Method, Boolean> methodConfiguration = new ConcurrentHashMap<Method, Boolean>();
+    private transient volatile Map<Method, Boolean> methodConfiguration = new ConcurrentHashMap<>();
     private transient volatile Set<ExecutableType> classConfiguration;
     private transient volatile Boolean constructorValidated;
 
@@ -204,7 +206,7 @@ public class BValInterceptor implements
                 methodConfig = methodConfiguration.get(method);
                 if (methodConfig == null) {
                     final List<Class<?>> classHierarchy =
-                        ClassHelper.fillFullClassHierarchyAsList(new LinkedList<Class<?>>(), targetClass);
+                        ClassHelper.fillFullClassHierarchyAsList(new LinkedList<>(), targetClass);
                     Collections.reverse(classHierarchy);
 
                     // search on method @ValidateOnExecution
@@ -213,19 +215,19 @@ public class BValInterceptor implements
                     for (final Class<?> c : classHierarchy) {
                         final AnnotatedType<?> annotatedType = CDI.current().getBeanManager().createAnnotatedType(c);
                         AnnotatedMethod<?> annotatedMethod = null;
+
                         for (final AnnotatedMethod<?> m : annotatedType.getMethods()) {
-                            if (!m.getJavaMember().getName().equals(method.getName())
-                                || !asList(method.getGenericParameterTypes())
+                            if (m.getJavaMember().getName().equals(method.getName())
+                                && asList(method.getGenericParameterTypes())
                                     .equals(asList(m.getJavaMember().getGenericParameterTypes()))) {
-                                continue;
+                                annotatedMethod = m;
+                                break;
                             }
-                            annotatedMethod = m;
-                            break;
+                        }
+                        if (annotatedMethod == null) {
+                            continue;
                         }
                         try {
-                            if (annotatedMethod == null) {
-                                continue;
-                            }
                             if (validateOnExecutionType == null) {
                                 final ValidateOnExecution vat = annotatedType.getAnnotation(ValidateOnExecution.class);
                                 if (vat != null) {

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptorBean.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptorBean.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptorBean.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptorBean.java Tue May  2 04:53:20 2017
@@ -43,12 +43,12 @@ public class BValInterceptorBean impleme
     private final InjectionTarget<BValInterceptor> injectionTarget;
 
     public BValInterceptorBean(final BeanManager bm) {
-        final Set<Type> t = new HashSet<Type>();
+        final Set<Type> t = new HashSet<>();
         t.add(BValInterceptor.class);
         t.add(Object.class);
         types = Collections.unmodifiableSet(t);
 
-        final Set<Annotation> q = new HashSet<Annotation>();
+        final Set<Annotation> q = new HashSet<>();
         q.add(DefaultLiteral.INSTANCE);
         q.add(AnyLiteral.INSTANCE);
         qualifiers = Collections.unmodifiableSet(q);
@@ -120,7 +120,7 @@ public class BValInterceptorBean impleme
 
     @Override
     public String getId() {
-        return "BValInterceptor-" + hashCode();
+        return String.format("%s-%d",BValInterceptor.class.getSimpleName(), hashCode());
     }
 
     private static class BValInterceptorInjectionPoint implements InjectionPoint {

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/DefaultLiteral.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/DefaultLiteral.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/DefaultLiteral.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/DefaultLiteral.java Tue May  2 04:53:20 2017
@@ -19,7 +19,6 @@
 package org.apache.bval.cdi;
 
 import javax.enterprise.inject.Default;
-import javax.enterprise.util.AnnotationLiteral;
 
 public class DefaultLiteral extends EmptyAnnotationLiteral<Default> implements Default {
     private static final long serialVersionUID = 1L;
@@ -28,6 +27,6 @@ public class DefaultLiteral extends Empt
 
     @Override
     public String toString() {
-        return "@javax.enterprise.inject.Default()";
+        return String.format("@%s()", Default.class.getName());
     }
 }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/EmptyAnnotationLiteral.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/EmptyAnnotationLiteral.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/EmptyAnnotationLiteral.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/EmptyAnnotationLiteral.java Tue May  2 04:53:20 2017
@@ -29,6 +29,7 @@ import javax.enterprise.util.AnnotationL
  * Taken from Apache OpenWebBeans.
  * @param <T>
  */
+@SuppressWarnings("serial")
 public abstract class EmptyAnnotationLiteral<T extends Annotation> extends AnnotationLiteral<T> {
     private Class<T> annotationType;
 
@@ -77,11 +78,10 @@ public abstract class EmptyAnnotationLit
     private Class<T> getAnnotationType(Class<?> definedClazz) {
         Type superClazz = definedClazz.getGenericSuperclass();
 
-        Class<T> clazz = null;
-
-        if (superClazz.equals(Object.class)) {
-            throw new RuntimeException("Super class must be parametrized type!");
-        } else if (superClazz instanceof ParameterizedType) {
+        if (Object.class.equals(superClazz)) {
+            throw new RuntimeException("Super class must be parameterized type!");
+        }
+        if (superClazz instanceof ParameterizedType) {
             ParameterizedType paramType = (ParameterizedType) superClazz;
             Type[] actualArgs = paramType.getActualTypeArguments();
 
@@ -89,17 +89,15 @@ public abstract class EmptyAnnotationLit
                 //Actual annotation type
                 Type type = actualArgs[0];
 
-                if (type instanceof Class) {
-                    clazz = (Class<T>) type;
+                if (type instanceof Class<?>) {
+                    @SuppressWarnings("unchecked")
+                    Class<T> clazz = (Class<T>) type;
                     return clazz;
-                } else {
-                    throw new RuntimeException("Not class type!");
                 }
-            } else {
-                throw new RuntimeException("More than one parametric type!");
+                throw new RuntimeException("Not class type!");
             }
-        } else {
-            return getAnnotationType((Class<?>) superClazz);
+            throw new RuntimeException("More than one parametric type!");
         }
+        return getAnnotationType((Class<?>) superClazz);
     }
 }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/ValidatorBean.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/ValidatorBean.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/ValidatorBean.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/ValidatorBean.java Tue May  2 04:53:20 2017
@@ -44,12 +44,12 @@ public class ValidatorBean implements Be
         this.factory = factory;
         this.instance = validator;
 
-        final Set<Type> t = new HashSet<Type>();
+        final Set<Type> t = new HashSet<>();
         t.add(Validator.class);
         t.add(Object.class);
         types = Collections.unmodifiableSet(t);
 
-        final Set<Annotation> q = new HashSet<Annotation>();
+        final Set<Annotation> q = new HashSet<>();
         q.add(DefaultLiteral.INSTANCE);
         q.add(AnyLiteral.INSTANCE);
         qualifiers = Collections.unmodifiableSet(q);
@@ -119,6 +119,6 @@ public class ValidatorBean implements Be
 
     @Override
     public String getId() {
-        return "BValValidator-" + hashCode();
+        return String.format("BVal%s-%d", Validator.class.getSimpleName(), hashCode());
     }
 }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/ValidatorFactoryBean.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/ValidatorFactoryBean.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/ValidatorFactoryBean.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/ValidatorFactoryBean.java Tue May  2 04:53:20 2017
@@ -41,12 +41,12 @@ public class ValidatorFactoryBean implem
     public ValidatorFactoryBean(final ValidatorFactory validatorFactory) {
         this.instance = validatorFactory;
 
-        final Set<Type> t = new HashSet<Type>();
+        final Set<Type> t = new HashSet<>();
         t.add(ValidatorFactory.class);
         t.add(Object.class);
         types = Collections.unmodifiableSet(t);
 
-        final Set<Annotation> q = new HashSet<Annotation>();
+        final Set<Annotation> q = new HashSet<>();
         q.add(DefaultLiteral.INSTANCE);
         q.add(AnyLiteral.INSTANCE);
         qualifiers = Collections.unmodifiableSet(q);
@@ -109,6 +109,6 @@ public class ValidatorFactoryBean implem
 
     @Override
     public String getId() {
-        return "BValValidatorFactory-" + hashCode();
+        return String.format("BVal%s-%d", ValidatorFactory.class.getSimpleName(), hashCode());
     }
 }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForNumber.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForNumber.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForNumber.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForNumber.java Tue May  2 04:53:20 2017
@@ -43,12 +43,14 @@ public class DecimalMaxValidatorForNumbe
         if (value == null) {
             return true;
         }
+        BigDecimal bigValue;
         if (value instanceof BigDecimal) {
-            return ((BigDecimal) value).compareTo(maxValue) != 1;
+            bigValue = (BigDecimal) value;
+        } else if (value instanceof BigInteger) {
+            bigValue = new BigDecimal((BigInteger) value);
+        } else {
+            bigValue = new BigDecimal(value.doubleValue());
         }
-        if (value instanceof BigInteger) {
-            return (new BigDecimal((BigInteger) value)).compareTo(maxValue) != 1;
-        }
-        return (new BigDecimal(value.doubleValue()).compareTo(maxValue)) != 1;
+        return bigValue.compareTo(maxValue) < 1;
     }
 }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForString.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForString.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForString.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForString.java Tue May  2 04:53:20 2017
@@ -46,7 +46,7 @@ public class DecimalMaxValidatorForStrin
             return true;
         }
         try {
-            return new BigDecimal(value).compareTo(maxValue) != 1;
+            return new BigDecimal(value).compareTo(maxValue) < 1;
         } catch (NumberFormatException nfe) {
             return false;
         }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForNumber.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForNumber.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForNumber.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForNumber.java Tue May  2 04:53:20 2017
@@ -43,12 +43,14 @@ public class DecimalMinValidatorForNumbe
         if (value == null) {
             return true;
         }
+        BigDecimal bigValue;
         if (value instanceof BigDecimal) {
-            return ((BigDecimal) value).compareTo(minValue) != -1;
+            bigValue = (BigDecimal) value;
+        } else if (value instanceof BigInteger) {
+            bigValue = new BigDecimal((BigInteger) value);
+        } else {
+            bigValue = new BigDecimal(value.doubleValue());
         }
-        if (value instanceof BigInteger) {
-            return (new BigDecimal((BigInteger) value)).compareTo(minValue) != -1;
-        }
-        return (new BigDecimal(value.doubleValue()).compareTo(minValue)) != -1;
+        return bigValue.compareTo(minValue) >= 0;
     }
 }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForString.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForString.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForString.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForString.java Tue May  2 04:53:20 2017
@@ -48,7 +48,7 @@ public class DecimalMinValidatorForStrin
             return true;
         }
         try {
-            return new BigDecimal(value).compareTo(minValue) != -1;
+            return new BigDecimal(value).compareTo(minValue) >= 0;
         } catch (NumberFormatException nfe) {
             return false;
         }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/Email.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/Email.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/Email.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/Email.java Tue May  2 04:53:20 2017
@@ -25,6 +25,7 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
 
 import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.METHOD;
 import static java.lang.annotation.ElementType.PARAMETER;
@@ -39,10 +40,12 @@ import static java.lang.annotation.Reten
  * </p>
  * Description: annotation to validate an email address (by pattern)<br/>
  */
+@Deprecated
 @Documented
 @Constraint(validatedBy = EmailValidator.class)
-@Target({ METHOD, FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
+// TODO compose spec Email or delete
 public @interface Email {
     Class<?>[] groups() default {};
 

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/EmailValidator.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/EmailValidator.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/EmailValidator.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/EmailValidator.java Tue May  2 04:53:20 2017
@@ -35,6 +35,6 @@ public class EmailValidator implements C
 
     @Override
     public void initialize(Email parameters) {
-        // do nothing (as long as Email has no properties)
+        // TODO
     }
 }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/FutureValidatorForCalendar.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/FutureValidatorForCalendar.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/FutureValidatorForCalendar.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/FutureValidatorForCalendar.java Tue May  2 04:53:20 2017
@@ -43,6 +43,7 @@ public class FutureValidatorForCalendar
      * @return current date/time
      */
     protected Calendar now() {
+        // TODO use Clock
         return Calendar.getInstance();
     }
 }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/FutureValidatorForDate.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/FutureValidatorForDate.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/FutureValidatorForDate.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/FutureValidatorForDate.java Tue May  2 04:53:20 2017
@@ -43,6 +43,7 @@ public class FutureValidatorForDate impl
      * @return current date/time
      */
     protected Date now() {
+        // TODO use Clock
         return new Date();
     }
 }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForNumber.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForNumber.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForNumber.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForNumber.java Tue May  2 04:53:20 2017
@@ -43,10 +43,10 @@ public class MaxValidatorForNumber imple
             return true;
         }
         if (value instanceof BigDecimal) {
-            return ((BigDecimal) value).compareTo(BigDecimal.valueOf(max)) != 1;
+            return ((BigDecimal) value).compareTo(BigDecimal.valueOf(max)) < 1;
         }
         if (value instanceof BigInteger) {
-            return ((BigInteger) value).compareTo(BigInteger.valueOf(max)) != 1;
+            return ((BigInteger) value).compareTo(BigInteger.valueOf(max)) < 1;
         }
         return value.longValue() <= max;
     }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForString.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForString.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForString.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForString.java Tue May  2 04:53:20 2017
@@ -42,7 +42,7 @@ public class MaxValidatorForString imple
             return true;
         }
         try {
-            return new BigDecimal(value).compareTo(BigDecimal.valueOf(max)) != 1;
+            return new BigDecimal(value).compareTo(BigDecimal.valueOf(max)) < 1;
         } catch (NumberFormatException nfe) {
             return false;
         }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForNumber.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForNumber.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForNumber.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForNumber.java Tue May  2 04:53:20 2017
@@ -42,10 +42,10 @@ public class MinValidatorForNumber imple
             return true;
         }
         if (value instanceof BigDecimal) {
-            return ((BigDecimal) value).compareTo(BigDecimal.valueOf(minValue)) != -1;
+            return ((BigDecimal) value).compareTo(BigDecimal.valueOf(minValue)) >= 0;
         }
         if (value instanceof BigInteger) {
-            return ((BigInteger) value).compareTo(BigInteger.valueOf(minValue)) != -1;
+            return ((BigInteger) value).compareTo(BigInteger.valueOf(minValue)) >= 0;
         }
         return value.longValue() >= minValue;
     }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForString.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForString.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForString.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForString.java Tue May  2 04:53:20 2017
@@ -42,7 +42,7 @@ public class MinValidatorForString imple
             return true;
         }
         try {
-            return new BigDecimal(value).compareTo(BigDecimal.valueOf(minValue)) != -1;
+            return new BigDecimal(value).compareTo(BigDecimal.valueOf(minValue)) >= 0;
         } catch (NumberFormatException nfe) {
             return false;
         }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmpty.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmpty.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmpty.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmpty.java Tue May  2 04:53:20 2017
@@ -41,6 +41,8 @@ import static java.lang.annotation.Reten
     NotEmptyValidatorForString.class, NotEmptyValidator.class })
 @Target({ METHOD, FIELD, ANNOTATION_TYPE, PARAMETER })
 @Retention(RUNTIME)
+@Deprecated
+// TODO compose or delete
 public @interface NotEmpty {
     Class<?>[] groups() default {};
 

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidator.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidator.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidator.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidator.java Tue May  2 04:53:20 2017
@@ -25,7 +25,7 @@ import java.lang.reflect.InvocationTarge
 import java.lang.reflect.Method;
 
 /**
- * Description:  Check the non emptyness of an
+ * Description:  Check the non emptiness of an
  * any object that has a public isEmpty():boolean or a valid toString() method
  */
 public class NotEmptyValidator implements ConstraintValidator<NotEmpty, Object> {
@@ -45,13 +45,9 @@ public class NotEmptyValidator implement
         try {
             final Method isEmptyMethod = value.getClass().getMethod("isEmpty");
             if (isEmptyMethod != null) {
-                return !((Boolean) isEmptyMethod.invoke(value)).booleanValue();
+                return !Boolean.TRUE.equals(isEmptyMethod.invoke(value));
             }
-        } catch (IllegalAccessException iae) {
-            // do nothing
-        } catch (NoSuchMethodException nsme) {
-            // do nothing
-        } catch (InvocationTargetException ite) {
+        } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException iae) {
             // do nothing
         }
         return !value.toString().isEmpty();

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/PastValidatorForCalendar.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/PastValidatorForCalendar.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/PastValidatorForCalendar.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/PastValidatorForCalendar.java Tue May  2 04:53:20 2017
@@ -43,6 +43,7 @@ public class PastValidatorForCalendar im
      * @return current date/time
      */
     protected Calendar now() {
+        // TODO use Clock
         return Calendar.getInstance();
     }
 }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/PastValidatorForDate.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/PastValidatorForDate.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/PastValidatorForDate.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/PastValidatorForDate.java Tue May  2 04:53:20 2017
@@ -43,6 +43,7 @@ public class PastValidatorForDate implem
      * @return current date/time
      */
     protected Date now() {
+        // use Clock
         return new Date();
     }
 }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/PatternValidator.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/PatternValidator.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/PatternValidator.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/PatternValidator.java Tue May  2 04:53:20 2017
@@ -27,7 +27,7 @@ import java.util.regex.PatternSyntaxExce
  * validator using a regular expression,
  * based on the jsr Pattern constraint annotation.
  */
-public class PatternValidator implements ConstraintValidator<Pattern, String> {
+public class PatternValidator implements ConstraintValidator<Pattern, CharSequence> {
     protected java.util.regex.Pattern pattern;
 
     @Override
@@ -46,7 +46,7 @@ public class PatternValidator implements
     }
 
     @Override
-    public boolean isValid(String value, ConstraintValidatorContext context) {
+    public boolean isValid(CharSequence value, ConstraintValidatorContext context) {
         return value == null || pattern.matcher(value).matches();
     }
 }

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/el/ELFacade.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/el/ELFacade.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/el/ELFacade.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/el/ELFacade.java Tue May  2 04:53:20 2017
@@ -54,10 +54,9 @@ public final class ELFacade implements M
             if (EXPRESSION_FACTORY != null) {
                 final BValELContext context = new BValELContext();
                 final VariableMapper variables = context.getVariableMapper();
-                for (final Map.Entry<String, Object> var : annotationParameters.entrySet()) {
-                    variables.setVariable(var.getKey(),
-                        EXPRESSION_FACTORY.createValueExpression(var.getValue(), Object.class));
-                }
+                annotationParameters.forEach(
+                    (k, v) -> variables.setVariable(k, EXPRESSION_FACTORY.createValueExpression(v, Object.class)));
+
                 variables.setVariable("validatedValue",
                     EXPRESSION_FACTORY.createValueExpression(validatedValue, Object.class));
 
@@ -83,13 +82,8 @@ public final class ELFacade implements M
     }
 
     private static class BValELContext extends ELContext {
-        private final FunctionMapper functions;
-        private final VariableMapper variables;
-
-        public BValELContext() {
-            this.variables = new BValVariableMapper();
-            this.functions = new BValFunctionMapper();
-        }
+        private final FunctionMapper functions = new BValFunctionMapper();
+        private final VariableMapper variables = new BValVariableMapper();
 
         @Override
         public ELResolver getELResolver() {

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationConstraintBuilder.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationConstraintBuilder.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationConstraintBuilder.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationConstraintBuilder.java Tue May  2 04:53:20 2017
@@ -72,7 +72,7 @@ final class AnnotationConstraintBuilder<
         final boolean reportFromComposite =
             annotation != null && annotation.annotationType().isAnnotationPresent(ReportAsSingleViolation.class);
         constraintValidation =
-            new ConstraintValidation<A>(validatorClasses, annotation, owner, access, reportFromComposite, target);
+            new ConstraintValidation<>(validatorClasses, annotation, owner, access, reportFromComposite, target);
         buildFromAnnotation();
     }
 
@@ -139,7 +139,7 @@ final class AnnotationConstraintBuilder<
         if (!foundGroups) {
             throw new ConstraintDefinitionException("Annotation " + annotationType.getName() + " has no groups method");
         }
-        if (validationAppliesTo != null && !ConstraintTarget.IMPLICIT.equals(validationAppliesTo.getDefaultValue())) {
+        if (validationAppliesTo != null && ConstraintTarget.IMPLICIT != validationAppliesTo.getDefaultValue()) {
             throw new ConstraintDefinitionException("validationAppliesTo default value should be IMPLICIT");
         }
 
@@ -257,9 +257,9 @@ final class AnnotationConstraintBuilder<
 
         final Set<Class<? extends Payload>> payloadSet;
         if (payload_raw == null) {
-            payloadSet = Collections.<Class<? extends Payload>> emptySet();
+            payloadSet = Collections.emptySet();
         } else {
-            payloadSet = new HashSet<Class<? extends Payload>>(payload_raw.length);
+            payloadSet = new HashSet<>(payload_raw.length);
             Collections.addAll(payloadSet, payload_raw);
         }
         constraintValidation.setPayload(payloadSet);
@@ -323,18 +323,13 @@ final class AnnotationConstraintBuilder<
      * @return An integer index always >= 0
      */
     private int computeIndex(ConstraintValidation<?> composite) {
-        int idx = 0;
-        for (ConstraintValidation<?> each : constraintValidation.getComposingValidations()) {
-            if (each.getAnnotation().annotationType() == composite.getAnnotation().annotationType()) {
-                idx++;
-            }
-        }
-        return idx;
+        return (int) constraintValidation.getComposingValidations().stream()
+            .filter(v -> v.getAnnotation().annotationType().equals(composite.getAnnotation().annotationType())).count();
     }
 
     /** read overridesAttributes from constraintValidation.annotation */
     private void buildOverridesAttributes() {
-        overrides = new LinkedList<ConstraintOverrides>();
+        overrides = new LinkedList<>();
         for (Method method : constraintValidation.getAnnotation().annotationType().getDeclaredMethods()) {
             final OverridesAttribute.List overridesAttributeList = method.getAnnotation(OverridesAttribute.List.class);
             if (overridesAttributeList != null) {
@@ -359,12 +354,9 @@ final class AnnotationConstraintBuilder<
     }
 
     private ConstraintOverrides findOverride(Class<? extends Annotation> constraint, int constraintIndex) {
-        for (ConstraintOverrides each : overrides) {
-            if (each.constraintType == constraint && each.constraintIndex == constraintIndex) {
-                return each;
-            }
-        }
-        return null;
+        return overrides.stream()
+            .filter(ov -> ov.constraintType.equals(constraint) && ov.constraintIndex == constraintIndex).findFirst()
+            .orElse(null);
     }
 
     /**
@@ -381,7 +373,7 @@ final class AnnotationConstraintBuilder<
         private ConstraintOverrides(Class<? extends Annotation> constraintType, int constraintIndex) {
             this.constraintType = constraintType;
             this.constraintIndex = constraintIndex;
-            values = new HashMap<String, Object>();
+            values = new HashMap<>();
         }
 
         @SuppressWarnings("unchecked")
@@ -392,11 +384,9 @@ final class AnnotationConstraintBuilder<
             // And the annotation
             final Annotation originalAnnot = composite.getAnnotation();
             final AnnotationProxyBuilder<Annotation> apb = new AnnotationProxyBuilder<Annotation>(originalAnnot);
-            for (String key : values.keySet()) {
-                apb.putValue(key, values.get(key));
-            }
-            final Annotation newAnnot = apb.createAnnotation();
-            ((ConstraintValidation<Annotation>) composite).setAnnotation(newAnnot);
+            values.forEach(apb::putValue);
+
+            ((ConstraintValidation<Annotation>) composite).setAnnotation(apb.createAnnotation());
         }
     }
 

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationProcessor.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationProcessor.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationProcessor.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationProcessor.java Tue May  2 04:53:20 2017
@@ -121,7 +121,7 @@ public final class AnnotationProcessor {
             if (!reflection) {
                 Collection<Annotation> annotations = prop.getFeature(JsrFeatures.Property.ANNOTATIONS_TO_PROCESS);
                 if (annotations == null) {
-                    annotations = new ArrayList<Annotation>();
+                    annotations = new ArrayList<>();
                     prop.putFeature(JsrFeatures.Property.ANNOTATIONS_TO_PROCESS, annotations);
                 }
                 annotations.add(annotation);
@@ -129,18 +129,19 @@ public final class AnnotationProcessor {
             return true;
         }
 
-        /**
+        /*
          * An annotation is considered a constraint definition if its retention
          * policy contains RUNTIME and if the annotation itself is annotated
          * with javax.validation.Constraint.
          */
         final Constraint vcAnno = annotation.annotationType().getAnnotation(Constraint.class);
         if (vcAnno != null) {
-            Class<? extends ConstraintValidator<A, ?>>[] validatorClasses;
-            validatorClasses = findConstraintValidatorClasses(annotation, vcAnno);
+            Class<? extends ConstraintValidator<A, ?>>[] validatorClasses =
+                findConstraintValidatorClasses(annotation, vcAnno);
             return applyConstraint(annotation, validatorClasses, prop, owner, access, appender);
         }
-        /**
+
+        /*
          * Multi-valued constraints: To support this requirement, the bean
          * validation provider treats regular annotations (annotations not
          * annotated by @Constraint) whose value element has a return type of an

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java Tue May  2 04:53:20 2017
@@ -92,7 +92,7 @@ public class ApacheFactoryContext implem
      * {@inheritDoc}
      */
     @Override
-    public ValidatorContext messageInterpolator(MessageInterpolator messageInterpolator) {
+    public ApacheFactoryContext messageInterpolator(MessageInterpolator messageInterpolator) {
         this.messageInterpolator = messageInterpolator;
         return this;
     }
@@ -101,7 +101,7 @@ public class ApacheFactoryContext implem
      * {@inheritDoc}
      */
     @Override
-    public ValidatorContext traversableResolver(TraversableResolver traversableResolver) {
+    public ApacheFactoryContext traversableResolver(TraversableResolver traversableResolver) {
         this.traversableResolver = traversableResolver;
         return this;
     }
@@ -110,13 +110,13 @@ public class ApacheFactoryContext implem
      * {@inheritDoc}
      */
     @Override
-    public ValidatorContext constraintValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory) {
+    public ApacheFactoryContext constraintValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory) {
         this.constraintValidatorFactory = constraintValidatorFactory;
         return this;
     }
 
     @Override
-    public ValidatorContext parameterNameProvider(ParameterNameProvider parameterNameProvider) {
+    public ApacheFactoryContext parameterNameProvider(ParameterNameProvider parameterNameProvider) {
         this.parameterNameProvider = parameterNameProvider;
         resetMeta(); // needed since parameter names are a component of validation metadata
         return this;

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorConfiguration.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorConfiguration.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorConfiguration.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorConfiguration.java Tue May  2 04:53:20 2017
@@ -32,7 +32,7 @@ public interface ApacheValidatorConfigur
     /**
      * Proprietary property keys for {@link ConfigurationImpl}  
      */
-    public interface Properties {
+    interface Properties {
         /**
          * the location where to look for the validation.xml file.
          * default: "META-INF/validation.xml"

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorFactory.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorFactory.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorFactory.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorFactory.java Tue May  2 04:53:20 2017
@@ -89,7 +89,7 @@ public class ApacheValidatorFactory impl
     private final ConcurrentMap<Class<?>, List<AccessStrategy>> validAccesses;
     private final ConcurrentMap<Class<?>, List<MetaConstraint<?, ? extends Annotation>>> constraintMap;
 
-    private final Collection<Closeable> toClose = new ArrayList<Closeable>();
+    private final Collection<Closeable> toClose = new ArrayList<>();
     private final MetaBeanFinder defaultMetaBeanFinder;
 
     /**
@@ -112,7 +112,7 @@ public class ApacheValidatorFactory impl
      * @return a new instance of MetaBeanManager with adequate MetaBeanFactories
      */
     protected MetaBeanFinder buildMetaBeanFinder() {
-        final List<MetaBeanFactory> builders = new ArrayList<MetaBeanFactory>();
+        final List<MetaBeanFactory> builders = new ArrayList<>();
         if (Boolean.parseBoolean(getProperties().get(ApacheValidatorConfiguration.Properties.ENABLE_INTROSPECTOR))) {
             builders.add(new IntrospectorMetaBeanFactory());
         }
@@ -121,9 +121,8 @@ public class ApacheValidatorFactory impl
         if (factoryClassNames != null) {
             for (String clsName : factoryClassNames) {
                 // cast, relying on #createMetaBeanFactory to throw the exception if incompatible:
-                @SuppressWarnings("unchecked")
                 final Class<? extends MetaBeanFactory> factoryClass =
-                    (Class<? extends MetaBeanFactory>) loadClass(clsName);
+                    loadClass(clsName).asSubclass(MetaBeanFactory.class);
                 builders.add(createMetaBeanFactory(factoryClass));
             }
         }
@@ -173,10 +172,10 @@ public class ApacheValidatorFactory impl
      * Create a new ApacheValidatorFactory instance.
      */
     public ApacheValidatorFactory(ConfigurationState configuration) {
-        properties = new HashMap<String, String>(configuration.getProperties());
-        defaultSequences = new HashMap<Class<?>, Class<?>[]>();
-        validAccesses = new ConcurrentHashMap<Class<?>, List<AccessStrategy>>();
-        constraintMap = new ConcurrentHashMap<Class<?>, List<MetaConstraint<?, ? extends Annotation>>>();
+        properties = new HashMap<>(configuration.getProperties());
+        defaultSequences = new HashMap<>();
+        validAccesses = new ConcurrentHashMap<>();
+        constraintMap = new ConcurrentHashMap<>();
 
         parameterNameProvider = configuration.getParameterNameProvider();
         messageResolver = configuration.getMessageInterpolator();
@@ -184,8 +183,7 @@ public class ApacheValidatorFactory impl
         constraintValidatorFactory = configuration.getConstraintValidatorFactory();
 
         if (ConfigurationImpl.class.isInstance(configuration)) {
-            final ConfigurationImpl impl = ConfigurationImpl.class.cast(configuration);
-            toClose.add(impl.getClosable());
+            toClose.add(ConfigurationImpl.class.cast(configuration).getClosable());
         }
 
         new ValidationMappingParser(this).processMappingConfig(configuration.getMappingStreams());
@@ -401,7 +399,7 @@ public class ApacheValidatorFactory impl
     public void addMetaConstraint(final Class<?> beanClass, final MetaConstraint<?, ?> metaConstraint) {
         List<MetaConstraint<?, ? extends Annotation>> slot = constraintMap.get(beanClass);
         if (slot == null) {
-            slot = new ArrayList<MetaConstraint<?, ? extends Annotation>>();
+            slot = new ArrayList<>();
             final List<MetaConstraint<?, ? extends Annotation>> old = constraintMap.putIfAbsent(beanClass, slot);
             if (old != null) {
                 slot = old;
@@ -420,7 +418,7 @@ public class ApacheValidatorFactory impl
     public void addValid(Class<?> beanClass, AccessStrategy accessStrategy) {
         List<AccessStrategy> slot = validAccesses.get(beanClass);
         if (slot == null) {
-            slot = new ArrayList<AccessStrategy>();
+            slot = new ArrayList<>();
             final List<AccessStrategy> old = validAccesses.putIfAbsent(beanClass, slot);
             if (old != null) {
                 slot = old;
@@ -468,7 +466,7 @@ public class ApacheValidatorFactory impl
      */
     public List<AccessStrategy> getValidAccesses(Class<?> beanClass) {
         final List<AccessStrategy> slot = validAccesses.get(beanClass);
-        return slot == null ? Collections.<AccessStrategy> emptyList() : Collections.unmodifiableList(slot);
+        return slot == null ? Collections.emptyList() : Collections.unmodifiableList(slot);
     }
 
     /**

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToBuilder.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToBuilder.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToBuilder.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToBuilder.java Tue May  2 04:53:20 2017
@@ -55,7 +55,7 @@ public class AppendValidationToBuilder e
         // Inherited groups and payload values must also be replicated in the 
         // annotation, so it has to be substituted with a new proxy.
         final T originalAnnot = validation.getAnnotation();
-        final AnnotationProxyBuilder<T> apb = new AnnotationProxyBuilder<T>(originalAnnot);
+        final AnnotationProxyBuilder<T> apb = new AnnotationProxyBuilder<>(originalAnnot);
         apb.putValue(ConstraintAnnotationAttributes.GROUPS.getAttributeName(),
             inheritedGroups.toArray(new Class[inheritedGroups.size()]));
         apb.putValue(ConstraintAnnotationAttributes.PAYLOAD.getAttributeName(),

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToList.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToList.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToList.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToList.java Tue May  2 04:53:20 2017
@@ -25,7 +25,7 @@ import java.util.List;
  * cache of validations for further processing.<br/>
  */
 public class AppendValidationToList extends BaseAppendValidation {
-    private final List<ConstraintValidation<?>> validations = new ArrayList<ConstraintValidation<?>>();
+    private final List<ConstraintValidation<?>> validations = new ArrayList<>();
 
     /**
      * {@inheritDoc}

Modified: bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/BeanDescriptorImpl.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/BeanDescriptorImpl.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/BeanDescriptorImpl.java (original)
+++ bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/BeanDescriptorImpl.java Tue May  2 04:53:20 2017
@@ -70,6 +70,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
 
 /**
  * Description: Implements {@link BeanDescriptor}.<br/>
@@ -77,7 +79,7 @@ import java.util.concurrent.CopyOnWriteA
 @Privilizing(@CallTo(Reflection.class))
 public class BeanDescriptorImpl extends ElementDescriptorImpl implements BeanDescriptor {
     private static final CopyOnWriteArraySet<ConstraintValidation<?>> NO_CONSTRAINTS =
-        new CopyOnWriteArraySet<ConstraintValidation<?>>();
+        new CopyOnWriteArraySet<>();
     private static final Validation[] EMPTY_VALIDATION = new Validation[0];
 
     /**
@@ -95,7 +97,7 @@ public class BeanDescriptorImpl extends
 
         Set<PropertyDescriptor> procedureDescriptors = metaBean.getFeature(Bean.PROPERTIES);
         if (procedureDescriptors == null) {
-            procedureDescriptors = new HashSet<PropertyDescriptor>();
+            procedureDescriptors = new HashSet<>();
             for (final MetaProperty prop : metaBean.getProperties()) {
                 if (prop.getValidations().length > 0
                     || (prop.getMetaBean() != null || prop.getFeature(Features.Property.REF_CASCADE) != null)) {
@@ -122,7 +124,7 @@ public class BeanDescriptorImpl extends
         boolean fieldFound = false;
         boolean methodFound = false;
         Class<?> current = prop.getParentMetaBean().getBeanClass();
-        while (current != null && current != Object.class && (!methodFound || !fieldFound)) {
+        while (current != null && !current.equals(Object.class) && (!methodFound || !fieldFound)) {
             if (!fieldFound) {
                 final Field field = Reflection.getDeclaredField(current, prop.getName());
                 if (field != null) {
@@ -278,26 +280,20 @@ public class BeanDescriptorImpl extends
 
     private static Collection<MethodDescriptor> filter(final Set<MethodDescriptor> containedMethods,
         final MethodType type) {
-        final Collection<MethodDescriptor> list = new ArrayList<MethodDescriptor>();
-        for (final MethodDescriptor d : containedMethods) {
-            final boolean getter =
-                d.getParameterDescriptors().isEmpty() && (d.getName().startsWith("get") || (d.getName().startsWith("is")
-                    && boolean.class.equals(d.getReturnValueDescriptor().getElementClass())));
+        Predicate<MethodDescriptor> filter = d -> d.getParameterDescriptors().isEmpty() && (d.getName()
+            .startsWith("get")
+            || (d.getName().startsWith("is") && boolean.class.equals(d.getReturnValueDescriptor().getElementClass())));
 
-            switch (type) {
+        switch (type) {
             case GETTER:
-                if (getter) {
-                    list.add(d);
-                }
                 break;
-
             case NON_GETTER:
-                if (!getter) {
-                    list.add(d);
-                }
-            }
+                filter = filter.negate();
+                break;
+            default:
+                return Collections.emptySet();
         }
-        return list;
+        return containedMethods.stream().filter(filter).collect(Collectors.toList());
     }
 
     @Override
@@ -319,26 +315,20 @@ public class BeanDescriptorImpl extends
      */
     @Override
     public String toString() {
-        return "BeanDescriptorImpl{" + "returnType=" + elementClass + '}';
+        return String.format("%s{returnType=%s}", BeanDescriptorImpl.class.getSimpleName(), elementClass);
     }
 
     private static <A extends ExecutableDescriptor> Set<A> toConstrained(final Collection<A> src) {
-        final Set<A> dest = new HashSet<A>();
-        for (final A d : src) {
-            if (d.hasConstrainedParameters() || d.hasConstrainedReturnValue()) {
-                dest.add(d);
-            }
-        }
-        return Collections.unmodifiableSet(dest);
+        return Collections.unmodifiableSet(src.stream()
+            .filter(d -> d.hasConstrainedParameters() || d.hasConstrainedReturnValue()).collect(Collectors.toSet()));
     }
 
     private static class ExecutableMeta {
         private final ApacheFactoryContext factoryContext;
         private final AnnotationProcessor annotationProcessor;
         private final MetaBean metaBean;
-        private final Map<String, MethodDescriptor> methodConstraints = new HashMap<String, MethodDescriptor>();
-        private final Map<String, ConstructorDescriptor> contructorConstraints =
-            new HashMap<String, ConstructorDescriptor>();
+        private final Map<String, MethodDescriptor> methodConstraints = new HashMap<>();
+        private final Map<String, ConstructorDescriptor> contructorConstraints = new HashMap<>();
         private Boolean isBeanConstrained = null;
 
         private ExecutableMeta(final ApacheFactoryContext factoryContext, final MetaBean metaBean1,
@@ -528,8 +518,7 @@ public class BeanDescriptorImpl extends
         private void buildMethodConstraints() throws InvocationTargetException, IllegalAccessException {
 
             final Class<?> current = metaBean.getBeanClass();
-            final List<Class<?>> classHierarchy =
-                ClassHelper.fillFullClassHierarchyAsList(new ArrayList<Class<?>>(), current);
+            final List<Class<?>> classHierarchy = ClassHelper.fillFullClassHierarchyAsList(new ArrayList<>(), current);
             classHierarchy.remove(current);
 
             for (final Method method : Reflection.getDeclaredMethods(current)) {
@@ -550,7 +539,7 @@ public class BeanDescriptorImpl extends
                     continue;
                 }
 
-                final Collection<Method> parents = new ArrayList<Method>();
+                final Collection<Method> parents = new ArrayList<>();
                 for (final Class<?> clazz : classHierarchy) {
                     final Method overridden =
                         Reflection.getDeclaredMethod(clazz, method.getName(), method.getParameterTypes());
@@ -607,7 +596,7 @@ public class BeanDescriptorImpl extends
                     }
 
                     final Class<?>[] interfaces = method.getDeclaringClass().getInterfaces();
-                    final Collection<Method> itfWithThisMethod = new ArrayList<Method>();
+                    final Collection<Method> itfWithThisMethod = new ArrayList<>();
                     for (final Class<?> i : interfaces) {
                         final Method m = Reflection.getDeclaredMethod(i, method.getName(), method.getParameterTypes());
                         if (m != null) {



Mime
View raw message