bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1793432 [1/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
Author: mbenson
Date: Tue May  2 04:53:20 2017
New Revision: 1793432

URL: http://svn.apache.org/viewvc?rev=1793432&view=rev
Log:
basic Java 8 upgrade

Modified:
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/BeanValidator.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/ConstructorAccess.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/MetaBeanCache.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/ValidationResults.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/DynaTypeEnum.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/Features.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaAnnotated.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaBean.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaInvocable.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/BValVersion.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/IndexedAccess.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/KeyedAccess.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/ObjectUtils.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/StringUtils.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/ValidationHelper.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/reflection/Reflection.java
    bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/reflection/TypeUtils.java
    bval/branches/bv2.x/bval-core/src/test/java/org/apache/bval/ValidationResultsTest.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ABANumber.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/CUSIP.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/EAN13.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBAN.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBANValidator.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ISBN10.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Luhn.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ModulusValidator.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Sedol.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Verhoeff.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffValidator.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/DirectoryValidator.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/SymlinkValidator.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/DomainValidator.java
    bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/InetAddressValidator.java
    bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ABANumberValidatorTest.java
    bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/AbstractCheckDigitTest.java
    bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/CUSIPValidatorTest.java
    bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/EAN13CheckDigitTest.java
    bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/IBANCheckDigitTest.java
    bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ISBN10CheckDigitTest.java
    bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/LuhnCheckDigitTest.java
    bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/SedolCheckDigitTest.java
    bval/branches/bv2.x/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffCheckDigitTest.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/AnyLiteral.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValAnnotatedType.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptor.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptorBean.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/DefaultLiteral.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/EmptyAnnotationLiteral.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/ValidatorBean.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/cdi/ValidatorFactoryBean.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForNumber.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForString.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForNumber.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForString.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/Email.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/EmailValidator.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/FutureValidatorForCalendar.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/FutureValidatorForDate.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForNumber.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForString.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForNumber.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForString.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmpty.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidator.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/PastValidatorForCalendar.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/PastValidatorForDate.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/constraints/PatternValidator.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/el/ELFacade.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationConstraintBuilder.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationProcessor.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorConfiguration.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorFactory.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToBuilder.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToList.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/BeanDescriptorImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ClassValidator.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ConfigurationImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintAnnotationAttributes.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintCached.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintDefaults.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintDescriptorImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintFinderImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidation.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidationListener.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorContextImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorIdentity.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintViolationImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/DefaultConstraintValidatorFactory.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/DefaultMessageInterpolator.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/DefaultValidationProviderResolver.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ElementDescriptorImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/GraphBeanIdentity.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/GroupValidationContextImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/InvocableElementDescriptor.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/JsrMetaBeanFactory.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/NodeBuilderCustomizableContextImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/NodeContextBuilderImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ParameterAccess.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/ParameterDescriptorImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/PropertyDescriptorImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/groups/Group.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/groups/GroupConversionDescriptorImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/groups/Groups.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/groups/GroupsComputer.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/parameter/DefaultParameterNameProvider.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/resolver/CachingTraversableResolver.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/util/ClassHelper.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/util/IOs.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/util/LeafNodeBuilderCustomizableContextImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/util/NodeBuilderCustomizableContextImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/util/NodeBuilderDefinedContextImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/util/NodeContextBuilderImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/util/NodeImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/util/PathImpl.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/util/PathNavigation.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/util/Proxies.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/util/ValidationContextTraversal.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/xml/AnnotationIgnores.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/xml/AnnotationProxy.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/xml/AnnotationProxyBuilder.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/xml/MetaConstraint.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/xml/ValidationMappingParser.java
    bval/branches/bv2.x/bval-jsr/src/main/java/org/apache/bval/jsr/xml/ValidationParser.java
    bval/branches/bv2.x/bval-xstream/src/main/java/org/apache/bval/routines/EMailValidation.java
    bval/branches/bv2.x/bval-xstream/src/main/java/org/apache/bval/routines/StandardValidation.java
    bval/branches/bv2.x/bval-xstream/src/main/java/org/apache/bval/xml/XMLFeaturesCapable.java
    bval/branches/bv2.x/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBean.java
    bval/branches/bv2.x/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanBuilder.java
    bval/branches/bv2.x/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanFactory.java
    bval/branches/bv2.x/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanInfos.java
    bval/branches/bv2.x/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManager.java
    bval/branches/bv2.x/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanURLLoader.java
    bval/branches/bv2.x/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaElement.java
    bval/branches/bv2.x/bval-xstream/src/test/java/org/apache/bval/routines/StandardValidationTest.java
    bval/branches/bv2.x/pom.xml

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java Tue May  2 04:53:20 2017
@@ -35,8 +35,11 @@ import java.util.Map;
  * <b>This class is NOT thread-safe: a new instance will be created for each
  * validation
  * processing per thread.<br/></b>
+ * @param <L> {@link ValidationListener} type
+ * @param <I> bean instance key
+ * @param <S> structure used to track bean instances
  */
-public class BeanValidationContext<T extends ValidationListener> implements ValidationContext<T> {
+public class BeanValidationContext<L extends ValidationListener, I, S> implements ValidationContext<L> {
     /** represent an unknown propertyValue. */
     private static final Object UNKNOWN = new Object() {
         @Override
@@ -61,8 +64,7 @@ public class BeanValidationContext<T ext
     private AccessStrategy access;
 
     /** set of objects already validated to avoid endless loops. */
-    @SuppressWarnings({ "rawtypes" })
-    protected Map validatedObjects;
+    protected Map<I, S> validatedObjects;
 
     /**
      * true when value is fixed, so that it will NOT be dynamically
@@ -73,15 +75,14 @@ public class BeanValidationContext<T ext
     private boolean fixed;
 
     /** listener notified of validation constraint violations. */
-    private T listener;
+    private L listener;
 
     /**
      * Create a new BeanValidationContext instance.
      * @param listener
      */
-    @SuppressWarnings({ "rawtypes" })
-    public BeanValidationContext(T listener) {
-        this(listener, new IdentityHashMap());
+    public BeanValidationContext(L listener) {
+        this(listener, new IdentityHashMap<>());
     }
 
     /**
@@ -89,8 +90,7 @@ public class BeanValidationContext<T ext
      * @param listener
      * @param validatedMap
      */
-    @SuppressWarnings({ "rawtypes" })
-    protected BeanValidationContext(T listener, Map validatedMap) {
+    protected BeanValidationContext(L listener, Map<I, S> validatedMap) {
         this.listener = listener;
         this.validatedObjects = validatedMap;
     }
@@ -99,7 +99,7 @@ public class BeanValidationContext<T ext
      * {@inheritDoc}
      */
     @Override
-    public T getListener() {
+    public L getListener() {
         return listener;
     }
 
@@ -107,7 +107,7 @@ public class BeanValidationContext<T ext
      * Set the listener.
      * @param listener T
      */
-    public void setListener(T listener) {
+    public void setListener(L listener) {
         this.listener = listener;
     }
 
@@ -115,10 +115,10 @@ public class BeanValidationContext<T ext
      * {@inheritDoc}
      * Here, state equates to a given bean reference.
      */
-    @Override
     @SuppressWarnings("unchecked")
+    @Override
     public boolean collectValidated() {
-        return validatedObjects.put(getBean(), Boolean.TRUE) == null;
+        return validatedObjects.put((I) getBean(), (S) Boolean.TRUE) == null;
     }
 
     /**
@@ -232,7 +232,7 @@ public class BeanValidationContext<T ext
      * @return something that is capable to deliver features
      */
     public FeaturesCapable getMeta() {
-        return (metaProperty == null) ? metaBean : metaProperty;
+        return metaProperty == null ? metaBean : metaProperty;
     }
 
     /**
@@ -303,8 +303,8 @@ public class BeanValidationContext<T ext
      */
     @Override
     public String toString() {
-        return "BeanValidationContext{ bean=" + bean + ", metaProperty=" + metaProperty + ", propertyValue="
-            + propertyValue + '}';
+        return String.format("BeanValidationContext{bean=%s, metaProperty=%s, propertyValue=%s}",
+            BeanValidationContext.class.getSimpleName(), bean, metaProperty, propertyValue);
     }
 
     /**

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/BeanValidator.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/BeanValidator.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/BeanValidator.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/BeanValidator.java Tue May  2 04:53:20 2017
@@ -173,7 +173,7 @@ public class BeanValidator<T extends Val
      * @return ValidationContext parameterized with our listener type
      */
     protected ValidationContext<T> createContext() {
-        return new BeanValidationContext<T>(createResults());
+        return new BeanValidationContext<>(createResults());
     }
 
     /**

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/ConstructorAccess.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/ConstructorAccess.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/ConstructorAccess.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/ConstructorAccess.java Tue May  2 04:53:20 2017
@@ -66,7 +66,7 @@ public class ConstructorAccess extends A
         if (this == o) {
             return true;
         }
-        if (o == null || getClass() != o.getClass()) {
+        if (o == null || !getClass().equals(o.getClass())) {
             return false;
         }
 

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java Tue May  2 04:53:20 2017
@@ -51,7 +51,7 @@ public class IntrospectorMetaBeanFactory
             meta.setName(info.getBeanDescriptor().getName()); // (display?)name = simple class name!
         }
         for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
-            if (!(pd instanceof IndexedPropertyDescriptor || pd.getName().equals("class"))) {
+            if (!(pd instanceof IndexedPropertyDescriptor || "class".equals(pd.getName()))) {
                 MetaProperty metaProp = buildMetaProperty(pd, meta.getProperty(pd.getName()));
                 meta.putProperty(pd.getName(), metaProp);
             }

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java Tue May  2 04:53:20 2017
@@ -42,7 +42,7 @@ public class MetaBeanBuilder {
      * Create a new MetaBeanBuilder instance.
      */
     public MetaBeanBuilder() {
-        this(new MetaBeanFactory[] { new IntrospectorMetaBeanFactory() });
+        this(new IntrospectorMetaBeanFactory());
     }
 
     /**
@@ -50,7 +50,7 @@ public class MetaBeanBuilder {
      * 
      * @param factories
      */
-    public MetaBeanBuilder(MetaBeanFactory[] factories) {
+    public MetaBeanBuilder(MetaBeanFactory... factories) {
         setFactories(factories);
     }
 
@@ -60,7 +60,7 @@ public class MetaBeanBuilder {
      * @return {@link MetaBeanFactory} array
      */
     public MetaBeanFactory[] getFactories() {
-        return factories != null ? factories.clone() : null;
+        return factories == null ? null : factories.clone();
     }
 
     /**
@@ -69,8 +69,8 @@ public class MetaBeanBuilder {
      * 
      * @param factories
      */
-    public void setFactories(MetaBeanFactory[] factories) {
-        this.factories = factories != null ? factories.clone() : null;
+    public void setFactories(MetaBeanFactory... factories) {
+        this.factories = factories == null ? null : factories.clone();
     }
 
     /**
@@ -92,7 +92,7 @@ public class MetaBeanBuilder {
      * @return Map of String : MetaBean
      */
     public Map<String, MetaBean> buildAll() throws Exception {
-        return new HashMap<String, MetaBean>();
+        return new HashMap<>();
     }
 
     /**

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/MetaBeanCache.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/MetaBeanCache.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/MetaBeanCache.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/MetaBeanCache.java Tue May  2 04:53:20 2017
@@ -32,11 +32,11 @@ public class MetaBeanCache implements Me
     /**
      * Cache keyed by id.
      */
-    protected final ConcurrentMap<String, MetaBean> cacheById = new ConcurrentHashMap<String, MetaBean>();
+    protected final ConcurrentMap<String, MetaBean> cacheById = new ConcurrentHashMap<>();
     /**
      * Cache keyed by class.
      */
-    protected final ConcurrentMap<Class<?>, MetaBean> cacheByClass = new ConcurrentHashMap<Class<?>, MetaBean>();
+    protected final ConcurrentMap<Class<?>, MetaBean> cacheByClass = new ConcurrentHashMap<>();
 
     /**
      * Create a new MetaBeanCache instance.
@@ -51,9 +51,7 @@ public class MetaBeanCache implements Me
      */
     public MetaBeanCache(Map<String, MetaBean> beans) {
         this();
-        for (MetaBean bean : beans.values()) {
-            cache(bean);
-        }
+        beans.values().forEach(this::cache);
     }
 
     /**

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/ValidationResults.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/ValidationResults.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/ValidationResults.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/ValidationResults.java Tue May  2 04:53:20 2017
@@ -21,6 +21,7 @@ import org.apache.bval.model.ValidationL
 
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -92,8 +93,8 @@ public class ValidationResults implement
      * not on instance creation to save memory garbage.
      */
     protected void initialize() {
-        errorsByReason = new LinkedHashMap<String, List<Error>>();
-        errorsByOwner = new LinkedHashMap<Object, Map<String, List<Error>>>();
+        errorsByReason = new LinkedHashMap<>();
+        errorsByOwner = new LinkedHashMap<>();
     }
 
     /**
@@ -102,16 +103,9 @@ public class ValidationResults implement
      * @see {@link Error#getReason()}
      */
     protected void addToReasonBucket(Error error) {
-        if (error.getReason() == null) {
-            return;
+        if (error.getReason() != null) {
+            errorsByReason.computeIfAbsent(error.getReason(), k -> new ArrayList<>()).add(error);
         }
-
-        List<Error> errors = errorsByReason.get(error.getReason());
-        if (errors == null) {
-            errors = new ArrayList<Error>();
-            errorsByReason.put(error.getReason(), errors);
-        }
-        errors.add(error);
     }
 
     /**
@@ -120,21 +114,10 @@ public class ValidationResults implement
      * @see {@link Error#getOwner()}
      */
     protected void addToOwnerBucket(Error error) {
-        if (error.getOwner() == null) {
-            return;
-        }
-
-        Map<String, List<Error>> errors = errorsByOwner.get(error.getOwner());
-        if (errors == null) {
-            errors = new HashMap<String, List<Error>>();
-            errorsByOwner.put(error.getOwner(), errors);
-        }
-        List<Error> list = errors.get(error.getPropertyName());
-        if (list == null) {
-            list = new ArrayList<Error>();
-            errors.put(error.getPropertyName(), list);
+        if (error.getOwner() != null) {
+            errorsByOwner.computeIfAbsent(error.getOwner(), k -> new HashMap<>())
+                .computeIfAbsent(error.getPropertyName(), k -> new ArrayList<>()).add(error);
         }
-        list.add(error);
     }
 
     /**
@@ -143,10 +126,7 @@ public class ValidationResults implement
      * @return map
      */
     public Map<String, List<Error>> getErrorsByReason() {
-        if (errorsByReason == null) {
-            return Collections.emptyMap();
-        }
-        return errorsByReason;
+        return errorsByReason == null ? Collections.emptyMap() : Collections.unmodifiableMap(errorsByReason);
     }
 
     /**
@@ -156,10 +136,7 @@ public class ValidationResults implement
      * @return map
      */
     public Map<Object, Map<String, List<Error>>> getErrorsByOwner() {
-        if (errorsByOwner == null) {
-            return Collections.emptyMap();
-        }
-        return errorsByOwner;
+        return errorsByOwner == null ? Collections.emptyMap() : Collections.unmodifiableMap(errorsByOwner);
     }
 
     /**
@@ -170,19 +147,8 @@ public class ValidationResults implement
         if (errorsByReason == null || (errorsByReason.isEmpty() && errorsByOwner.isEmpty())) {
             return true;
         }
-        for (List<Error> list : errorsByReason.values()) {
-            if (!list.isEmpty()) {
-                return false;
-            }
-        }
-        for (Map<String, List<Error>> map : errorsByOwner.values()) {
-            for (List<Error> list : map.values()) {
-                if (!list.isEmpty()) {
-                    return false;
-                }
-            }
-        }
-        return true;
+        return errorsByReason.values().stream().allMatch(Collection::isEmpty) && errorsByOwner.values().stream()
+            .map(Map::values).flatMap(Collection::stream).allMatch(Collection::isEmpty);
     }
 
     /**
@@ -215,12 +181,7 @@ public class ValidationResults implement
             return false;
         }
         if (propertyName == null) {
-            for (List<Error> list : errors.values()) {
-                if (!list.isEmpty()) {
-                    return true;
-                }
-            }
-            return false;
+            return !errors.values().stream().allMatch(Collection::isEmpty);
         }
         List<Error> list = errors.get(propertyName);
         return list != null && !list.isEmpty();

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/DynaTypeEnum.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/DynaTypeEnum.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/DynaTypeEnum.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/DynaTypeEnum.java Tue May  2 04:53:20 2017
@@ -16,6 +16,8 @@
  */
 package org.apache.bval.model;
 
+import java.util.stream.Stream;
+
 /**
  * Description: ("artificial" enum with custom values).<br/>
  */
@@ -46,11 +48,7 @@ public class DynaTypeEnum implements Dyn
      * @param names
      */
     public void setEnumNames(String[] names) {
-        enumConstants = new Value[names.length];
-        int i = 0;
-        for (String each : names) {
-            enumConstants[i++] = new Value(each);
-        }
+        enumConstants = Stream.of(names).map(Value::new).toArray(Value[]::new);
     }
 
     /**
@@ -83,7 +81,7 @@ public class DynaTypeEnum implements Dyn
      * @return Value[]
      */
     public Value[] getEnumConstants() {
-        return enumConstants != null ? enumConstants.clone() : null;
+        return enumConstants == null ? null : enumConstants.clone();
     }
 
     /**

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/Features.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/Features.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/Features.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/Features.java Tue May  2 04:53:20 2017
@@ -26,7 +26,7 @@ package org.apache.bval.model;
  */
 public interface Features {
     /** Features of {@link MetaBean} */
-    public interface Bean {
+    interface Bean {
         /** INFO: String, name of the Property, that is the Primary Key */
         String MAIN_KEY = "mainKey";
         /** INFO: category/domain to which the metaBean belongs to */
@@ -40,7 +40,7 @@ public interface Features {
     }
 
     /** Features of {@link MetaProperty} */
-    public interface Property {
+    interface Property {
         /** INFO: possible Enum values */
         String ENUM = "enum";
         /** INFO: Boolean, TRUE if Property is a Unique Key */

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java Tue May  2 04:53:20 2017
@@ -20,6 +20,8 @@ import java.io.Serializable;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
 
 /**
  * Description: abstract superclass of meta objects that support a map of
@@ -69,13 +71,10 @@ public abstract class FeaturesCapable im
      * @param defaultValue
      * @return T
      */
-    @SuppressWarnings("unchecked")
     public <T> T getFeature(String key, T defaultValue) {
+        @SuppressWarnings("unchecked")
         final T value = (T) features.get(key);
-        if (value == null) {
-            return defaultValue;
-        }
-        return value;
+        return value == null ? defaultValue : value;
     }
 
     /**
@@ -129,7 +128,7 @@ public abstract class FeaturesCapable im
      * @return Validation array
      */
     public Validation[] getValidations() {
-        return validations != null ? validations.clone() : null;
+        return validations == null ? null : validations.clone();
     }
 
     /**
@@ -138,7 +137,7 @@ public abstract class FeaturesCapable im
      * @param validations
      */
     public void setValidations(Validation[] validations) {
-        this.validations = validations != null ? validations.clone() : null;
+        this.validations = validations == null ? null : validations.clone();
     }
 
     /**
@@ -165,15 +164,7 @@ public abstract class FeaturesCapable im
      * @return true if found
      */
     public boolean hasValidation(Validation aValidation) {
-        if (validations == null) {
-            return false;
-        }
-        for (Validation validation : validations) {
-            if (validation.equals(aValidation)) {
-                return true;
-            }
-        }
-        return false;
+        return validations != null && Stream.of(validations).anyMatch(Predicate.isEqual(aValidation));
     }
 
     /**
@@ -181,6 +172,6 @@ public abstract class FeaturesCapable im
      * @return ConcurrentMap
      */
     protected ConcurrentMap<String, Object> createFeaturesMap() {
-        return new ConcurrentHashMap<String, Object>();
+        return new ConcurrentHashMap<>();
     }
 }

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaAnnotated.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaAnnotated.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaAnnotated.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaAnnotated.java Tue May  2 04:53:20 2017
@@ -25,7 +25,7 @@ import org.apache.bval.util.ObjectUtils;
 public abstract class MetaAnnotated extends Meta {
     private static final long serialVersionUID = 1L;
 
-    private Set<Annotation> annotations = new HashSet<Annotation>();
+    private Set<Annotation> annotations = new HashSet<>();
     private Annotation[] annArray = null;
 
     public Annotation[] getAnnotations() {

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaBean.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaBean.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaBean.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaBean.java Tue May  2 04:53:20 2017
@@ -24,6 +24,7 @@ import java.util.Arrays;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.SortedMap;
 import java.util.TreeMap;
 
 import org.apache.bval.util.reflection.Reflection;
@@ -44,9 +45,9 @@ public class MetaBean extends FeaturesCa
     private String name;
     private Class<?> beanClass;
 
-    private Map<String, MetaProperty> properties = null;
-    private Map<Method, MetaMethod> methods = null;
-    private Map<Constructor<?>, MetaConstructor> constructors = null;
+    private SortedMap<String, MetaProperty> properties;
+    private Map<Method, MetaMethod> methods;
+    private Map<Constructor<?>, MetaConstructor> constructors;
 
     /**
      * Get the id.
@@ -109,15 +110,15 @@ public class MetaBean extends FeaturesCa
             final Map<Method, MetaMethod> oldMethods = methods;
             final Map<Constructor<?>, MetaConstructor> oldConstructors = constructors;
 
-            properties = new TreeMap<String, MetaProperty>(new FieldComparator(beanClass));
+            properties = new TreeMap<>(new FieldComparator(beanClass));
             if (oldProperties != null) {
                 properties.putAll(oldProperties);
             }
-            methods = new TreeMap<Method, MetaMethod>(new MethodComparator(beanClass));
+            methods = new TreeMap<>(new MethodComparator(beanClass));
             if (oldMethods != null) {
                 methods.putAll(oldMethods);
             }
-            constructors = new TreeMap<Constructor<?>, MetaConstructor>(new ConstructorComparator(beanClass));
+            constructors = new TreeMap<>(new ConstructorComparator(beanClass));
             if (oldConstructors != null) {
                 constructors.putAll(oldConstructors);
             }
@@ -145,14 +146,14 @@ public class MetaBean extends FeaturesCa
 
     public void addMethod(final Method method, final MetaMethod meta) {
         if (methods == null) {
-            methods = new HashMap<Method, MetaMethod>();
+            methods = new HashMap<>();
         }
         methods.put(method, meta);
     }
 
     public void addConstructor(final Constructor<?> constructor, final MetaConstructor meta) {
         if (constructors == null) {
-            constructors = new HashMap<Constructor<?>, MetaConstructor>();
+            constructors = new HashMap<>();
         }
         constructors.put(constructor, meta);
     }
@@ -164,12 +165,22 @@ public class MetaBean extends FeaturesCa
      *            the MetaProperty[] to set
      */
     public void setProperties(MetaProperty[] properties) {
-        this.properties = new HashMap<String, MetaProperty>();
-        for (final MetaProperty property : properties) {
-            this.properties.put(property.getName(), property);
+        initProperties();
+        for (MetaProperty mp : properties) {
+            this.properties.put(mp.getName(), mp);
         }
     }
 
+    private SortedMap<String, MetaProperty> initProperties() {
+        synchronized (this) {
+            if (properties == null) {
+                properties = new TreeMap<>(
+                    beanClass == null ? Comparator.<String> naturalOrder() : new FieldComparator(beanClass));
+            }
+        }
+        return properties;
+    }
+
     /**
      * Get the specified {@link MetaProperty}.
      * 
@@ -177,10 +188,7 @@ public class MetaBean extends FeaturesCa
      * @return MetaProperty found or <code>null</code>
      */
     public MetaProperty getProperty(String name) {
-        if (properties == null) {
-            return null;
-        }
-        return this.properties.get(name);
+        return properties == null ? null : this.properties.get(name);
     }
 
     /**
@@ -190,15 +198,7 @@ public class MetaBean extends FeaturesCa
      * @return true when at least one of the properties is a relationship
      */
     public boolean hasRelationships() {
-        if (properties == null) {
-            return false;
-        }
-        for (MetaProperty property : this.properties.values()) {
-            if (property.isRelationship()) {
-                return true;
-            }
-        }
-        return false;
+        return properties != null && properties.values().stream().anyMatch(MetaProperty::isRelationship);
     }
 
     /**
@@ -209,9 +209,7 @@ public class MetaBean extends FeaturesCa
      *            if <code>null</code>, remove
      */
     public void putProperty(String name, MetaProperty property) {
-        if (properties == null) {
-            properties = new HashMap<String, MetaProperty>();
-        }
+        initProperties();
         if (property == null) {
             this.properties.remove(name);
         } else {
@@ -225,7 +223,8 @@ public class MetaBean extends FeaturesCa
      */
     @Override
     public String toString() {
-        return "MetaBean{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", beanClass=" + beanClass + '}';
+        return String.format("%s{id='%s', name='%s', beanClass=%s", MetaBean.class.getSimpleName(), id, name,
+            beanClass);
     }
 
     /**
@@ -236,10 +235,9 @@ public class MetaBean extends FeaturesCa
         super.copyInto(target);
         final MetaBean copy = (MetaBean) target;
         if (properties != null) {
-            copy.properties = new TreeMap<String, MetaProperty>();
-            for (Map.Entry<String, MetaProperty> entry : properties.entrySet()) {
-                copy.properties.put(entry.getKey(), (MetaProperty) entry.getValue().copy());
-            }
+            copy.properties = null;
+            copy.initProperties();
+            properties.forEach((k, v) -> copy.properties.put(k, v.copy()));
         }
     }
 
@@ -272,7 +270,7 @@ public class MetaBean extends FeaturesCa
     }
 
     protected static class FieldComparator implements Comparator<String> {
-        private final Map<String, Integer> fields = new HashMap<String, Integer>();
+        private final Map<String, Integer> fields = new HashMap<>();
 
         protected FieldComparator(final Class<?> beanClass) {
             int i = 0;
@@ -333,7 +331,7 @@ public class MetaBean extends FeaturesCa
     }
 
     protected static class MethodComparator implements Comparator<Method> {
-        private final Map<Method, Integer> methods = new HashMap<Method, Integer>();
+        private final Map<Method, Integer> methods = new HashMap<>();
 
         protected MethodComparator(final Class<?> beanClass) {
             Class<?> clazz = beanClass;
@@ -357,7 +355,7 @@ public class MetaBean extends FeaturesCa
     }
 
     protected static class ConstructorComparator implements Comparator<Constructor<?>> {
-        private final Map<Constructor<?>, Integer> constructors = new HashMap<Constructor<?>, Integer>();
+        private final Map<Constructor<?>, Integer> constructors = new HashMap<>();
 
         protected ConstructorComparator(final Class<?> beanClass) {
             for (final Constructor<?> c : Reflection.getDeclaredConstructors(beanClass)) {

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaInvocable.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaInvocable.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaInvocable.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaInvocable.java Tue May  2 04:53:20 2017
@@ -16,18 +16,18 @@
  */
 package org.apache.bval.model;
 
-import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
 public abstract class MetaInvocable extends MetaAnnotated {
     private static final long serialVersionUID = 1L;
 
-    private Map<Integer, MetaParameter> parameters = new HashMap<Integer, MetaParameter>();
+    private Map<Integer, MetaParameter> parameters = new HashMap<>();
 
     public Collection<MetaParameter> getParameters() {
-        return new ArrayList<MetaParameter>(parameters.values());
+        return Collections.unmodifiableCollection(parameters.values());
     }
 
     public void addParameter(final int idx, final MetaParameter param) {

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java Tue May  2 04:53:20 2017
@@ -36,12 +36,6 @@ public class MetaProperty extends Meta i
     private MetaBean metaBean;
 
     /**
-     * Create a new MetaProperty instance.
-     */
-    public MetaProperty() {
-    }
-
-    /**
      * Get the metabean of the target bean (mainly for relationships).
      * @return MetaBean (may be null).
      */
@@ -116,7 +110,7 @@ public class MetaProperty extends Meta i
      * @see {@link Features.Property#MANDATORY}
      */
     public boolean isMandatory() {
-        return getFeature(MANDATORY, Boolean.FALSE).booleanValue();
+        return Boolean.TRUE.equals(getFeature(MANDATORY));
     }
 
     /**
@@ -159,6 +153,6 @@ public class MetaProperty extends Meta i
      */
     @Override
     public String toString() {
-        return "MetaProperty{" + "name='" + name + '\'' + ", type=" + type + '}';
+        return String.format("%s{name='%s', type=%s}", MetaProperty.class.getSimpleName(), name, type);
     }
 }

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java Tue May  2 04:53:20 2017
@@ -29,12 +29,11 @@ public class EMailValidationUtils {
     private static String ATOM = "[^\\x00-\\x1F\\(\\)\\<\\>\\@\\,\\;\\:\\\\\\\"\\.\\[\\]\\s]";
     private static String DOMAIN = "(" + ATOM + "+(\\." + ATOM + "+)*";
     private static String IP_DOMAIN = "\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\]";
-    public static final java.util.regex.Pattern DEFAULT_EMAIL_PATTERN;
+    public static final Pattern DEFAULT_EMAIL_PATTERN;
 
     static {
-        DEFAULT_EMAIL_PATTERN =
-            java.util.regex.Pattern.compile("^" + ATOM + "+(\\." + ATOM + "+)*@" + DOMAIN + "|" + IP_DOMAIN + ")$",
-                java.util.regex.Pattern.CASE_INSENSITIVE);
+        DEFAULT_EMAIL_PATTERN = Pattern.compile("^" + ATOM + "+(\\." + ATOM + "+)*@" + DOMAIN + "|" + IP_DOMAIN + ")$",
+            Pattern.CASE_INSENSITIVE);
     }
 
     /**

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/BValVersion.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/BValVersion.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/BValVersion.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/BValVersion.java Tue May  2 04:53:20 2017
@@ -54,21 +54,17 @@ public class BValVersion {
 
     static {
         Properties revisionProps = new Properties();
-        try {
-            InputStream in = BValVersion.class.getResourceAsStream("/META-INF/org.apache.bval.revision.properties");
+        try (InputStream in = BValVersion.class.getResourceAsStream("/META-INF/org.apache.bval.revision.properties")) {
             if (in != null) {
-                try {
-                    revisionProps.load(in);
-                } finally {
-                    in.close();
-                }
+                revisionProps.load(in);
             }
         } catch (IOException ioe) {
         }
 
         String vers = revisionProps.getProperty("project.version");
-        if (vers == null || "".equals(vers.trim()))
+        if (vers == null || "".equals(vers.trim())) {
             vers = "0.0.0";
+        }
         VERSION_NUMBER = vers;
 
         StringTokenizer tok = new StringTokenizer(VERSION_NUMBER, ".-");

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java Tue May  2 04:53:20 2017
@@ -97,7 +97,7 @@ public class FieldAccess extends AccessS
         if (this == o) {
             return true;
         }
-        if (o == null || getClass() != o.getClass()) {
+        if (o == null || !getClass().equals(o.getClass())) {
             return false;
         }
 

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/IndexedAccess.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/IndexedAccess.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/IndexedAccess.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/IndexedAccess.java Tue May  2 04:53:20 2017
@@ -46,7 +46,7 @@ public class IndexedAccess extends Acces
         if (TypeUtils.isAssignable(containerType, Iterable.class)) {
             Map<TypeVariable<?>, Type> typeArguments = TypeUtils.getTypeArguments(containerType, Iterable.class);
             Type type = TypeUtils.unrollVariables(typeArguments, ITERABLE_TYPE);
-            return type != null ? type : Object.class;
+            return type == null ? Object.class : type;
         }
         return null;
     }

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/KeyedAccess.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/KeyedAccess.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/KeyedAccess.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/KeyedAccess.java Tue May  2 04:53:20 2017
@@ -22,6 +22,7 @@ import java.lang.annotation.ElementType;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
 import java.util.Map;
+import java.util.Optional;
 
 /**
  * {@link AccessStrategy} to get a keyed value from a {@link Map}. Contains
@@ -43,7 +44,7 @@ public class KeyedAccess extends AccessS
     public static Type getJavaElementType(Type containerType) {
         if (TypeUtils.isAssignable(containerType, Map.class)) {
             Map<TypeVariable<?>, Type> typeArguments = TypeUtils.getTypeArguments(containerType, Map.class);
-            return ObjectUtils.defaultIfNull(TypeUtils.unrollVariables(typeArguments, MAP_TYPEVARS[1]), Object.class);
+            return Optional.ofNullable(TypeUtils.unrollVariables(typeArguments, MAP_TYPEVARS[1])).orElse(Object.class);
         }
         return null;
     }
@@ -83,11 +84,7 @@ public class KeyedAccess extends AccessS
                     final Object result = map.get(Enum.valueOf((Class<? extends Enum>) rawKeyType, name));
                     return result;
                 }
-                for (Map.Entry<?, ?> e : map.entrySet()) {
-                    if (name.equals(e.getKey())) {
-                        return e.getValue();
-                    }
-                }
+                return map.get(name);
             }
         }
         return null;

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java Tue May  2 04:53:20 2017
@@ -89,9 +89,7 @@ public class MethodAccess extends Access
         final boolean mustUnset = Reflection.setAccessible(method, true);
         try {
             return method.invoke(instance);
-        } catch (IllegalAccessException e) {
-            throw new IllegalArgumentException(e);
-        } catch (InvocationTargetException e) {
+        } catch (IllegalAccessException | InvocationTargetException e) {
             throw new IllegalArgumentException(e);
         } finally {
             if (mustUnset) {
@@ -132,7 +130,7 @@ public class MethodAccess extends Access
         if (this == o) {
             return true;
         }
-        if (o == null || getClass() != o.getClass()) {
+        if (o == null || !getClass().equals(o.getClass())) {
             return false;
         }
 

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/ObjectUtils.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/ObjectUtils.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/ObjectUtils.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/ObjectUtils.java Tue May  2 04:53:20 2017
@@ -18,6 +18,8 @@ package org.apache.bval.util;
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Array;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
 
 public final class ObjectUtils {
     public static final Class<?>[] EMPTY_CLASS_ARRAY = new Class[0];
@@ -44,7 +46,7 @@ public final class ObjectUtils {
      * @return {@code object} if it is not {@code null}, defaultValue otherwise
      */
     public static <T> T defaultIfNull(final T object, final T defaultValue) {
-        return object != null ? object : defaultValue;
+        return object == null ? defaultValue : object;
     }
 
     public static <T> boolean isNotEmpty(final T[] array) {
@@ -68,29 +70,19 @@ public final class ObjectUtils {
         if (array == null) {
             return false;
         }
-        for (Object o : array) {
-            if (o.equals(objectToFind)) {
-                return true;
-            }
-        }
-        return false;
+        return Stream.of(array).anyMatch(Predicate.isEqual(objectToFind));
     }
 
     public static <T> T[] arrayAdd(T[] array, T objectToAdd) {
-        Class<?> type;
-        if (array != null) {
-            type = array.getClass().getComponentType();
-        } else if (objectToAdd != null) {
-            type = objectToAdd.getClass();
-        } else {
+        if (array == null && objectToAdd == null) {
             throw new IllegalArgumentException("Arguments cannot both be null");
         }
         final int arrayLength = Array.getLength(array);
+        @SuppressWarnings("unchecked")
         T[] newArray = (T[]) Array.newInstance(array.getClass().getComponentType(), arrayLength + 1);
         System.arraycopy(array, 0, newArray, 0, arrayLength);
         newArray[newArray.length - 1] = objectToAdd;
 
         return newArray;
-
     }
 }

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java Tue May  2 04:53:20 2017
@@ -33,6 +33,8 @@ import java.lang.reflect.Type;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.logging.Level;
@@ -51,7 +53,7 @@ public class PropertyAccess extends Acce
     private static final String BEANUTILS_PROPERTY_ACCESS = "org.apache.bval.util.BeanUtilsPropertyAccess";
     private static final Constructor<? extends PropertyAccess> BEANUTILS_PROPERTY_ACCESS_CTOR;
     private static final ConcurrentMap<Class<?>, Map<String, PropertyDescriptor>> PROPERTY_DESCRIPTORS =
-        new ConcurrentHashMap<Class<?>, Map<String, PropertyDescriptor>>();
+        new ConcurrentHashMap<>();
 
     static {
         final ClassLoader cl = Reflection.getClassLoader(PropertyAccess.class);
@@ -206,10 +208,8 @@ public class PropertyAccess extends Acce
 
     private static Method getPropertyReadMethod(String propertyName, Class<?> beanClass) {
         final Map<String, PropertyDescriptor> propertyDescriptors = getPropertyDescriptors(beanClass);
-        if (propertyDescriptors.containsKey(propertyName)) {
-            return propertyDescriptors.get(propertyName).getReadMethod();
-        }
-        return null;
+        return Optional.ofNullable(propertyDescriptors.get(propertyName)).map(PropertyDescriptor::getReadMethod)
+            .orElse(null);
     }
 
     private static Field getField(String propertyName, Class<?> beanClass) {
@@ -291,7 +291,7 @@ public class PropertyAccess extends Acce
         if (this == o) {
             return true;
         }
-        if (o == null || getClass() != o.getClass()) {
+        if (o == null || !getClass().equals(o.getClass())) {
             return false;
         }
 
@@ -305,10 +305,7 @@ public class PropertyAccess extends Acce
      */
     @Override
     public int hashCode() {
-        int result;
-        result = beanClass.hashCode();
-        result = 31 * result + propertyName.hashCode();
-        return result;
+        return Objects.hash(beanClass, propertyName);
     }
 
     private static Map<String, PropertyDescriptor> getPropertyDescriptors(Class<?> type) {
@@ -321,7 +318,7 @@ public class PropertyAccess extends Acce
             if (propertyDescriptors == null) {
                 m = Collections.emptyMap();
             } else {
-                m = new HashMap<String, PropertyDescriptor>();
+                m = new HashMap<>();
                 for (PropertyDescriptor pd : propertyDescriptors) {
                     m.put(pd.getName(), pd);
                 }

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/StringUtils.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/StringUtils.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/StringUtils.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/StringUtils.java Tue May  2 04:53:20 2017
@@ -17,8 +17,6 @@
 package org.apache.bval.util;
 
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 
 public final class StringUtils {
@@ -93,51 +91,6 @@ public final class StringUtils {
         return true;
     }
 
-    public static String join(Collection<?> values, String joinToken) {
-        if (values == null) {
-            return null;
-        }
-        if (values.size() == 0) {
-            return "";
-        }
-        if (values.size() == 1) {
-            return values.iterator().next().toString();
-        }
-        if (joinToken == null) {
-            joinToken = "null"; // backward compat with commons-lang StringUtils...
-        }
-
-        StringBuilder sb = new StringBuilder(values.size() * (16 + joinToken.length()));
-        Iterator<?> it = values.iterator();
-        sb.append(it.next());
-        while (it.hasNext()) {
-            sb.append(joinToken).append(it.next());
-        }
-        return sb.toString();
-    }
-
-    public static String joinArray(Object[] values, String joinToken) {
-        if (values == null) {
-            return null;
-        }
-        if (values.length == 0) {
-            return "";
-        }
-        if (values.length == 1) {
-            return values[0].toString();
-        }
-        if (joinToken == null) {
-            joinToken = "null"; // backward compat with commons-lang StringUtils...
-        }
-
-        StringBuilder sb = new StringBuilder(values.length * (16 + joinToken.length()));
-        sb.append(values[0]);
-        for (int i = 1; i < values.length; i++) {
-            sb.append(joinToken).append(values[i]);
-        }
-        return sb.toString();
-    }
-
     /**
      * <p>Splits the provided text into an array, separator is whitespace.
      */
@@ -149,12 +102,12 @@ public final class StringUtils {
      * <p>Splits the provided text into an array, separator is whitespace.
      */
     public static String[] split(String str, Character token) {
-        if (str == null || str.length() == 0) {
+        if (str == null || str.isEmpty()) {
             return ObjectUtils.EMPTY_STRING_ARRAY;
         }
 
         // split on token
-        List<String> ret = new ArrayList<String>();
+        List<String> ret = new ArrayList<>();
         StringBuilder sb = new StringBuilder(str.length());
         for (int pos = 0; pos < str.length(); pos++) {
             char c = str.charAt(pos);

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/ValidationHelper.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/ValidationHelper.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/ValidationHelper.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/ValidationHelper.java Tue May  2 04:53:20 2017
@@ -41,7 +41,7 @@ public class ValidationHelper {
      * . Its {@link #validate()} method will be called accordingly for every
      * dispatch.
      */
-    public static interface ValidateCallback {
+    public interface ValidateCallback {
         void validate();
     }
 

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/reflection/Reflection.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/reflection/Reflection.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/reflection/Reflection.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/reflection/Reflection.java Tue May  2 04:53:20 2017
@@ -61,8 +61,6 @@ public class Reflection {
         PRIMITIVE_WRAPPER_MAP.put(Void.TYPE, Void.TYPE);
     }
 
-
-
     /**
      * <p>Converts the specified primitive Class object to its corresponding
      * wrapper Class object.</p>
@@ -129,8 +127,7 @@ public class Reflection {
         return cl == null ? clazz.getClassLoader() : cl;
     }
 
-    public static Class<?> toClass(String className) throws ClassNotFoundException
-    {
+    public static Class<?> toClass(String className) throws ClassNotFoundException {
         ClassLoader cl = getClassLoader(Reflection.class);
         return toClass(className, cl);
     }
@@ -142,7 +139,7 @@ public class Reflection {
      *
      * @throws RuntimeException on load error
      */
-    public static Class toClass(String className, ClassLoader loader) throws ClassNotFoundException {
+    public static Class<?> toClass(String className, ClassLoader loader) throws ClassNotFoundException {
         return toClass(className, false, loader);
     }
 
@@ -153,7 +150,7 @@ public class Reflection {
      *
      * @throws RuntimeException on load error
      */
-    public static Class toClass(String className, boolean resolve, ClassLoader loader) throws ClassNotFoundException {
+    public static Class<?> toClass(String className, boolean resolve, ClassLoader loader) throws ClassNotFoundException {
         if (className == null) {
             throw new NullPointerException("className == null");
         }
@@ -171,7 +168,7 @@ public class Reflection {
             for (int i = 0; !primitive && (i < NATIVE_CODES.length); i++) {
                 if (NATIVE_CODES[i][1].equals(className)) {
                     if (dims == 0) {
-                        return (Class) NATIVE_CODES[i][0];
+                        return (Class<?>) NATIVE_CODES[i][0];
                     }
                     className = (String) NATIVE_CODES[i][2];
                     primitive = true;

Modified: bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/reflection/TypeUtils.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/reflection/TypeUtils.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/reflection/TypeUtils.java (original)
+++ bval/branches/bv2.x/bval-core/src/main/java/org/apache/bval/util/reflection/TypeUtils.java Tue May  2 04:53:20 2017
@@ -28,7 +28,9 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
+import java.util.stream.Stream;
 
 import org.apache.bval.util.Validate;
 
@@ -148,13 +150,7 @@ public class TypeUtils {
          */
         @Override
         public int hashCode() {
-            int result = 71 << 4;
-            result |= raw.hashCode();
-            result <<= 4;
-            result |= useOwner == null ? 0 : useOwner.hashCode();
-            result <<= 8;
-            result |= Arrays.hashCode(typeArguments);
-            return result;
+            return Objects.hash(raw, useOwner, typeArguments);
         }
     }
 
@@ -173,8 +169,8 @@ public class TypeUtils {
          * @param lowerBounds of this type
          */
         private WildcardTypeImpl(final Type[] upperBounds, final Type[] lowerBounds) {
-            this.upperBounds = upperBounds != null ? upperBounds : EMPTY_BOUNDS;
-            this.lowerBounds = lowerBounds != null ? lowerBounds : EMPTY_BOUNDS;
+            this.upperBounds = upperBounds == null ? EMPTY_BOUNDS : upperBounds;
+            this.lowerBounds = lowerBounds == null ? EMPTY_BOUNDS : lowerBounds;
         }
 
         /**
@@ -214,11 +210,7 @@ public class TypeUtils {
          */
         @Override
         public int hashCode() {
-            int result = 73 << 8;
-            result |= Arrays.hashCode(upperBounds);
-            result <<= 8;
-            result |= Arrays.hashCode(lowerBounds);
-            return result;
+            return Objects.hash(upperBounds, lowerBounds);
         }
     }
 
@@ -320,19 +312,13 @@ public class TypeUtils {
         if (type instanceof TypeVariable<?>) {
             // if any of the bounds are assignable to the class, then the
             // type is assignable to the class.
-            for (final Type bound : ((TypeVariable<?>) type).getBounds()) {
-                if (isAssignable(bound, toClass)) {
-                    return true;
-                }
-            }
-
-            return false;
+            return Stream.of(((TypeVariable<?>) type).getBounds()).anyMatch(bound -> isAssignable(bound, toClass));
         }
 
         // the only classes to which a generic array type can be assigned
         // are class Object and array classes
         if (type instanceof GenericArrayType) {
-            return toClass.equals(Object.class)
+            return Object.class.equals(toClass)
                     || toClass.isArray()
                     && isAssignable(((GenericArrayType) type).getGenericComponentType(), toClass
                             .getComponentType());
@@ -554,25 +540,15 @@ public class TypeUtils {
 
         if (type instanceof WildcardType) {
             // so long as one of the upper bounds is assignable, it's good
-            for (final Type bound : getImplicitUpperBounds((WildcardType) type)) {
-                if (isAssignable(bound, toGenericArrayType)) {
-                    return true;
-                }
-            }
-
-            return false;
+            return Stream.of(getImplicitUpperBounds((WildcardType) type))
+                .anyMatch(bound -> isAssignable(bound, toGenericArrayType));
         }
 
         if (type instanceof TypeVariable<?>) {
             // probably should remove the following logic and just return false.
             // type variables cannot specify arrays as bounds.
-            for (final Type bound : getImplicitBounds((TypeVariable<?>) type)) {
-                if (isAssignable(bound, toGenericArrayType)) {
-                    return true;
-                }
-            }
-
-            return false;
+            return Stream.of(getImplicitBounds((TypeVariable<?>) type))
+                .anyMatch(bound -> isAssignable(bound, toGenericArrayType));
         }
 
         if (type instanceof ParameterizedType) {
@@ -871,8 +847,7 @@ public class TypeUtils {
                     getRawType(parameterizedOwnerType), subtypeVarAssigns);
         } else {
             // no owner, prep the type variable assignments map
-            typeVarAssigns = subtypeVarAssigns == null ? new HashMap<TypeVariable<?>, Type>()
-                    : new HashMap<TypeVariable<?>, Type>(subtypeVarAssigns);
+            typeVarAssigns = subtypeVarAssigns == null ? new HashMap<>() : new HashMap<>(subtypeVarAssigns);
         }
 
         // get the subject parameterized type's arguments
@@ -917,7 +892,7 @@ public class TypeUtils {
             if (toClass.isPrimitive()) {
                 // dealing with widening here. No type arguments to be
                 // harvested with these two types.
-                return new HashMap<TypeVariable<?>, Type>();
+                return new HashMap<>();
             }
 
             // work with wrapper the wrapper class instead of the primitive
@@ -925,8 +900,8 @@ public class TypeUtils {
         }
 
         // create a copy of the incoming map, or an empty one if it's null
-        final HashMap<TypeVariable<?>, Type> typeVarAssigns = subtypeVarAssigns == null ? new HashMap<TypeVariable<?>, Type>()
-                : new HashMap<TypeVariable<?>, Type>(subtypeVarAssigns);
+        final Map<TypeVariable<?>, Type> typeVarAssigns =
+            subtypeVarAssigns == null ? new HashMap<>() : new HashMap<>(subtypeVarAssigns);
 
         // has target class been reached?
         if (toClass.equals(cls)) {
@@ -1030,7 +1005,7 @@ public class TypeUtils {
             return bounds;
         }
 
-        final Set<Type> types = new HashSet<Type>(bounds.length);
+        final Set<Type> types = new HashSet<>(bounds.length);
 
         for (final Type type1 : bounds) {
             boolean subtypeFound = false;
@@ -1243,7 +1218,7 @@ public class TypeUtils {
                 if (p.getOwnerType() == null) {
                     parameterizedTypeArguments = typeArguments;
                 } else {
-                    parameterizedTypeArguments = new HashMap<TypeVariable<?>, Type>(typeArguments);
+                    parameterizedTypeArguments = new HashMap<>(typeArguments);
                     parameterizedTypeArguments.putAll(TypeUtils.getTypeArguments(p));
                 }
                 final Type[] args = p.getActualTypeArguments();

Modified: bval/branches/bv2.x/bval-core/src/test/java/org/apache/bval/ValidationResultsTest.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-core/src/test/java/org/apache/bval/ValidationResultsTest.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-core/src/test/java/org/apache/bval/ValidationResultsTest.java (original)
+++ bval/branches/bv2.x/bval-core/src/test/java/org/apache/bval/ValidationResultsTest.java Tue May  2 04:53:20 2017
@@ -37,7 +37,7 @@ public class ValidationResultsTest {
     @Test
     public void testValidationResults() throws Exception {
         assertTrue(results.isEmpty());
-        BeanValidationContext<ValidationResults> ctx = new BeanValidationContext<ValidationResults>(results);
+        BeanValidationContext<ValidationResults, Object, Boolean> ctx = new BeanValidationContext<>(results);
         ctx.setBean(this);
         ctx.setMetaProperty(new MetaProperty());
         ctx.getMetaProperty().setName("prop");

Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ABANumber.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ABANumber.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ABANumber.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ABANumber.java Tue May  2 04:53:20 2017
@@ -25,7 +25,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;
 
@@ -40,7 +42,7 @@ import static java.lang.annotation.Reten
  */
 @Documented
 @Constraint(validatedBy = ABANumberValidator.class)
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface ABANumber {
 

Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/CUSIP.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/CUSIP.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/CUSIP.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/CUSIP.java Tue May  2 04:53:20 2017
@@ -25,7 +25,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;
 
@@ -40,7 +42,7 @@ import static java.lang.annotation.Reten
  */
 @Documented
 @Constraint(validatedBy = CUSIPValidator.class)
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface CUSIP {
 

Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/EAN13.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/EAN13.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/EAN13.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/EAN13.java Tue May  2 04:53:20 2017
@@ -25,7 +25,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;
 
@@ -40,7 +42,7 @@ import static java.lang.annotation.Reten
  */
 @Documented
 @Constraint(validatedBy = EAN13Validator.class)
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface EAN13 {
 

Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBAN.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBAN.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBAN.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBAN.java Tue May  2 04:53:20 2017
@@ -25,7 +25,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;
 
@@ -40,7 +42,7 @@ import static java.lang.annotation.Reten
  */
 @Documented
 @Constraint(validatedBy = IBANValidator.class)
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface IBAN {
 

Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBANValidator.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBANValidator.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBANValidator.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBANValidator.java Tue May  2 04:53:20 2017
@@ -26,7 +26,7 @@ import static java.lang.Character.getNum
 /**
  * <b>IBAN</b> (International Bank Account Number) Check Digit calculation/validation.
  * <p>
- * This rountine is based on the ISO 7064 Mod 97,10 check digit caluclation routine.
+ * This routine is based on the ISO 7064 Mod 97,10 check digit caluclation routine.
  * <p>
  * The two check digit characters in a IBAN number are the third and fourth characters
  * in the code. For <i>check digit</i> calculation/validation the first four characters are moved
@@ -40,7 +40,7 @@ import static java.lang.Character.getNum
  *  <a href="http://en.wikipedia.org/wiki/International_Bank_Account_Number">Wikipedia -
  *  IBAN number</a>.
  */
-public final class IBANValidator implements ConstraintValidator<IBAN, String> {
+public final class IBANValidator implements ConstraintValidator<IBAN, CharSequence> {
 
     private static final long MAX = 999999999;
 
@@ -50,12 +50,12 @@ public final class IBANValidator impleme
      * {@inheritDoc}
      */
     @Override
-    public boolean isValid(String code, ConstraintValidatorContext context) {
+    public boolean isValid(CharSequence code, ConstraintValidatorContext context) {
         if (code.length() < 5) {
             return false;
         }
 
-        String reformattedCode = code.substring(4) + code.substring(0, 4);
+        String reformattedCode = code.subSequence(4, code.length()).toString() + code.subSequence(0, 4).toString();
         long total = 0;
         for (int i = 0; i < reformattedCode.length(); i++) {
             int charValue = getNumericValue(reformattedCode.charAt(i));

Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ISBN10.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ISBN10.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ISBN10.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ISBN10.java Tue May  2 04:53:20 2017
@@ -25,7 +25,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;
 
@@ -40,7 +42,7 @@ import static java.lang.annotation.Reten
  */
 @Documented
 @Constraint(validatedBy = ISBN10Validator.class)
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface ISBN10 {
 

Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Luhn.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Luhn.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Luhn.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Luhn.java Tue May  2 04:53:20 2017
@@ -25,7 +25,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;
 
@@ -40,7 +42,7 @@ import static java.lang.annotation.Reten
  */
 @Documented
 @Constraint(validatedBy = LuhnValidator.class)
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface Luhn {
 

Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ModulusValidator.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ModulusValidator.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ModulusValidator.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ModulusValidator.java Tue May  2 04:53:20 2017
@@ -38,7 +38,7 @@ import static java.lang.Character.isDigi
  *
  * @param <A>
  */
-abstract class ModulusValidator<A extends Annotation> implements ConstraintValidator<A, String> {
+abstract class ModulusValidator<A extends Annotation> implements ConstraintValidator<A, CharSequence> {
 
     private final int modulus;
 
@@ -58,7 +58,7 @@ abstract class ModulusValidator<A extend
      * {@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/checkdigit/Sedol.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Sedol.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Sedol.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Sedol.java Tue May  2 04:53:20 2017
@@ -25,7 +25,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;
 
@@ -40,7 +42,7 @@ import static java.lang.annotation.Reten
  */
 @Documented
 @Constraint(validatedBy = SedolValidator.class)
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface Sedol {
 

Modified: bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Verhoeff.java
URL: http://svn.apache.org/viewvc/bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Verhoeff.java?rev=1793432&r1=1793431&r2=1793432&view=diff
==============================================================================
--- bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Verhoeff.java (original)
+++ bval/branches/bv2.x/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Verhoeff.java Tue May  2 04:53:20 2017
@@ -25,7 +25,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;
 
@@ -40,7 +42,7 @@ import static java.lang.annotation.Reten
  */
 @Documented
 @Constraint(validatedBy = VerhoeffValidator.class)
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface Verhoeff {
 



Mime
View raw message