You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bval.apache.org by mb...@apache.org on 2018/02/25 19:38:21 UTC

[1/6] bval git commit: clean up no-longer-used code from JSR module

Repository: bval
Updated Branches:
  refs/heads/bv2 f1e8de164 -> 92c64b3ce


http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/xml/MetaConstraint.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/xml/MetaConstraint.java b/bval-jsr/src/main/java/org/apache/bval/jsr/xml/MetaConstraint.java
deleted file mode 100644
index 1826a55..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/xml/MetaConstraint.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.bval.jsr.xml;
-
-import org.apache.bval.ConstructorAccess;
-import org.apache.bval.util.AccessStrategy;
-import org.apache.bval.util.FieldAccess;
-import org.apache.bval.util.MethodAccess;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-
-/**
- * Description: hold parsed information from xml to complete MetaBean later<br/>
- */
-//TODO move this guy up to org.apache.bval.jsr or org.apache.bval.jsr.model
-//to decouple ApacheValidatorFactory from xml package and allow others to consume MetaConstraint
-public class MetaConstraint<T, A extends Annotation> {
-
-    /** The member the constraint was defined on. */
-    private final Member member;
-
-    /** The class of the bean hosting this constraint. */
-    private final Class<T> beanClass;
-
-    /** constraint annotation (proxy) */
-    private final A annotation;
-
-    private Integer index; // for parameters
-
-    private final AccessStrategy accessStrategy;
-
-    /**
-     * Create a new MetaConstraint instance.
-     * @param beanClass The class in which the constraint is defined on
-     * @param member    The member on which the constraint is defined on, {@code null} if it is a class constraint}
-     * @param annotation
-     */
-    public MetaConstraint(Class<T> beanClass, Member member, A annotation) {
-        this.member = member;
-        this.beanClass = beanClass;
-        this.annotation = annotation;
-        if (member != null) {
-            accessStrategy = createAccessStrategy(member);
-            /*TODO: see if can really be removed
-            if (accessStrategy == null || accessStrategy.getPropertyName() == null) { // can happen if method does not follow the bean convention
-                throw new ValidationException("Annotated method does not follow the JavaBeans naming convention: " + member);
-            }
-            */
-        } else {
-            this.accessStrategy = null;
-        }
-    }
-
-    private static AccessStrategy createAccessStrategy(Member member) {
-        if (member instanceof Method) {
-            return new MethodAccess((Method) member);
-        } else if (member instanceof Field) {
-            return new FieldAccess((Field) member);
-        } else if (member instanceof Constructor<?>) {
-            return new ConstructorAccess((Constructor<?>) member);
-        } else {
-            return null; // class level
-        }
-    }
-
-    /**
-     * Get the bean class of this constraint.
-     * @return Class
-     */
-    public Class<T> getBeanClass() {
-        return beanClass;
-    }
-
-    /**
-     * Get the member to which this constraint applies.
-     * @return Member
-     */
-    public Member getMember() {
-        return member;
-    }
-
-    /**
-     * Get the annotation that defines this constraint.
-     * @return Annotation
-     */
-    public A getAnnotation() {
-        return annotation;
-    }
-
-    /**
-     * Get the access strategy used for the associated property.
-     * @return {@link AccessStrategy}
-     */
-    public AccessStrategy getAccessStrategy() {
-        return accessStrategy;
-    }
-
-    public Integer getIndex() {
-        return index;
-    }
-
-    public void setIndex(final int index) {
-        this.index = index;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/xml/SchemaManager.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/xml/SchemaManager.java b/bval-jsr/src/main/java/org/apache/bval/jsr/xml/SchemaManager.java
index a502b7e..5a79b63 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/xml/SchemaManager.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/xml/SchemaManager.java
@@ -276,7 +276,6 @@ public class SchemaManager {
         schemaRewriter.setContentHandler(unmarshallerHandler);
 
         xmlReader.parse(input);
-
         schemaValidator.validate();
 
         @SuppressWarnings("unchecked")

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintValidatorContextTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintValidatorContextTest.java b/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintValidatorContextTest.java
deleted file mode 100644
index 5aa1de9..0000000
--- a/bval-jsr/src/test/java/org/apache/bval/jsr/ConstraintValidatorContextTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.bval.jsr;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import javax.validation.ConstraintValidatorContext;
-import javax.validation.ConstraintValidatorContext.ConstraintViolationBuilder;
-
-import org.apache.bval.jsr.util.PathImpl;
-import org.apache.bval.model.ValidationListener;
-import org.apache.bval.model.ValidationListener.Error;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.mockito.stubbing.Answer;
-
-/**
- * Checks to validate the correct implementation of
- * {@link ConstraintValidatorContext} and its sub-interfaces.
- * 
- * @author Carlos Vara
- */
-@RunWith(MockitoJUnitRunner.class)
-public class ConstraintValidatorContextTest {
-
-    private ConstraintValidatorContextImpl cvc;
-    private ConstraintViolationBuilder cvb;
-
-    @Mock
-    private GroupValidationContext<ValidationListener> groupValidationContext;
-
-    /**
-     * {@inheritDoc}
-     */
-    @Before
-    public void setUp() throws Exception {
-        Mockito.when(groupValidationContext.getPropertyPath()).thenAnswer(new Answer<PathImpl>() {
-
-            @Override
-            public PathImpl answer(InvocationOnMock invocation) throws Throwable {
-                return PathImpl.createPathFromString("");
-            }
-        });
-        this.cvc = new ConstraintValidatorContextImpl(groupValidationContext, null);
-        this.cvc.disableDefaultConstraintViolation();
-        this.cvb = cvc.buildConstraintViolationWithTemplate("dummy.msg.tpl");
-    }
-
-    @Test
-    public void testPerson1() {
-        cvb.addNode("person").addNode(null).inIterable().atIndex(1).addConstraintViolation();
-        final Error error = cvc.getErrorMessages().iterator().next();
-        final PathImpl errorPath = (PathImpl) error.getOwner();
-        assertEquals("Incorrect path created", "person[1]", errorPath.toString());
-    }
-
-    @Test
-    public void testPersonLawyerName() {
-        cvb.addNode("person").addNode("name").inIterable().atKey("john").addConstraintViolation();
-        Error error = cvc.getErrorMessages().iterator().next();
-        PathImpl errorPath = (PathImpl) error.getOwner();
-        assertEquals("Incorrect path created", "person[john].name", errorPath.toString());
-    }
-
-    @Test
-    public void test0Name() {
-        cvb.addNode(null).addNode("name").inIterable().atIndex(0).addNode(null).inIterable().addConstraintViolation();
-        Error error = cvc.getErrorMessages().iterator().next();
-        PathImpl errorPath = (PathImpl) error.getOwner();
-        assertEquals("Incorrect path created", "[0].name[]", errorPath.toString());
-    }
-
-    @Test
-    public void testEmptyIndex() {
-        cvb.addNode(null).addNode(null).inIterable().addConstraintViolation();
-        Error error = cvc.getErrorMessages().iterator().next();
-        PathImpl errorPath = (PathImpl) error.getOwner();
-        assertEquals("Incorrect path created", "[]", errorPath.toString());
-    }
-
-    @Test
-    public void testRootPath() {
-        // Adding only nulls should still give a root path
-        cvb.addNode(null).addNode(null).addNode(null).addNode(null).addConstraintViolation();
-        Error error = cvc.getErrorMessages().iterator().next();
-        PathImpl errorPath = (PathImpl) error.getOwner();
-        assertTrue("Created path must be a root path", errorPath.isRootPath());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/test/java/org/apache/bval/jsr/groups/GroupSequenceTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/jsr/groups/GroupSequenceTest.java b/bval-jsr/src/test/java/org/apache/bval/jsr/groups/GroupSequenceTest.java
index d5cf4f2..d6651b3 100644
--- a/bval-jsr/src/test/java/org/apache/bval/jsr/groups/GroupSequenceTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/jsr/groups/GroupSequenceTest.java
@@ -20,8 +20,10 @@ package org.apache.bval.jsr.groups;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 
-import java.util.List;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.Set;
 
 import javax.validation.ConstraintViolation;
@@ -29,15 +31,14 @@ import javax.validation.GroupSequence;
 import javax.validation.constraints.NotNull;
 
 import org.apache.bval.jsr.ApacheValidatorFactory;
-import org.apache.bval.jsr.JsrFeatures;
 import org.apache.bval.jsr.ValidationTestBase;
+import org.apache.bval.jsr.descriptor.BeanD;
 import org.apache.bval.jsr.example.Author;
 import org.apache.bval.jsr.example.Book;
 import org.apache.bval.jsr.example.First;
 import org.apache.bval.jsr.example.Last;
 import org.apache.bval.jsr.example.Second;
 import org.apache.bval.jsr.util.TestUtils;
-import org.apache.bval.model.MetaBean;
 import org.junit.Test;
 
 /**
@@ -47,44 +48,34 @@ public class GroupSequenceTest extends ValidationTestBase {
 
     @Test
     public void testGroupSequence1() {
-        MetaBean metaBean =
-            ApacheValidatorFactory.getDefault().usingContext().getMetaBeanFinder().findForClass(GInterface1.class);
-        List<Group> gseq = metaBean.getFeature(JsrFeatures.Bean.GROUP_SEQUENCE);
-        assertNotNull(gseq);
-        assertEquals(1, gseq.size());
-        assertEquals(Group.DEFAULT, gseq.get(0));
+        BeanD bean = (BeanD) ApacheValidatorFactory.getDefault().usingContext().getValidator()
+            .getConstraintsForClass(GInterface1.class);
+
+        assertEquals(Collections.singletonList(GInterface1.class), bean.getGroupSequence());
     }
 
     @Test
     public void testGroupSequence2() {
-        MetaBean metaBean =
-            ApacheValidatorFactory.getDefault().usingContext().getMetaBeanFinder().findForClass(GClass1.class);
-        List<Group> gseq = metaBean.getFeature(JsrFeatures.Bean.GROUP_SEQUENCE);
-        assertNotNull(gseq);
-        assertEquals(1, gseq.size());
-        assertEquals(Group.DEFAULT, gseq.get(0));
+        BeanD bean = (BeanD) ApacheValidatorFactory.getDefault().usingContext().getValidator()
+            .getConstraintsForClass(GClass1.class);
+
+        assertNull(bean.getGroupSequence());
     }
 
     @Test
     public void testGroupSequence3() {
-        MetaBean metaBean =
-            ApacheValidatorFactory.getDefault().usingContext().getMetaBeanFinder().findForClass(GClass2.class);
-        List<Group> gseq = metaBean.getFeature(JsrFeatures.Bean.GROUP_SEQUENCE);
-        assertNotNull(gseq);
-        assertEquals(2, gseq.size());
-        assertEquals(new Group(GClass1.class), gseq.get(0));
-        assertEquals(Group.DEFAULT, gseq.get(1));
+        BeanD bean = (BeanD) ApacheValidatorFactory.getDefault().usingContext().getValidator()
+                .getConstraintsForClass(GClass2.class);
+
+        assertEquals(Arrays.asList(GClass1.class, GClass2.class), bean.getGroupSequence());
     }
 
     @Test
     public void testGroupSequence4() {
-        MetaBean metaBean =
-            ApacheValidatorFactory.getDefault().usingContext().getMetaBeanFinder().findForClass(GClass3.class);
-        List<Group> gseq = metaBean.getFeature(JsrFeatures.Bean.GROUP_SEQUENCE);
-        assertNotNull(gseq);
-        assertEquals(2, gseq.size());
-        assertEquals(Group.DEFAULT, gseq.get(0));
-        assertEquals(new Group(GClass1.class), gseq.get(1));
+        BeanD bean = (BeanD) ApacheValidatorFactory.getDefault().usingContext().getValidator()
+                .getConstraintsForClass(GClass3.class);
+
+        assertEquals(Arrays.asList(GClass3.class, GClass1.class), bean.getGroupSequence());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/test/java/org/apache/bval/jsr/util/EnumerationConverterTestCase.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/jsr/util/EnumerationConverterTestCase.java b/bval-jsr/src/test/java/org/apache/bval/jsr/util/EnumerationConverterTestCase.java
deleted file mode 100644
index 4f15606..0000000
--- a/bval-jsr/src/test/java/org/apache/bval/jsr/util/EnumerationConverterTestCase.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.bval.jsr.util;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.commons.beanutils.Converter;
-import org.junit.Test;
-
-/**
- * EnumerationConverter tester.
- *
- * $Id: EnumerationConverterTestCase.java 1161648 2011-08-25 17:14:15Z
- * romanstumm $
- */
-public final class EnumerationConverterTestCase {
-
-    @Test
-    public void testEnum() {
-        Converter converter = EnumerationConverter.getInstance();
-
-        Thread.State expected = Thread.State.TERMINATED;
-        Thread.State actual = (Thread.State) converter.convert(Thread.State.class, Thread.State.TERMINATED.name());
-        assertEquals(expected, actual);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-tck/work-tests-suite.xml
----------------------------------------------------------------------
diff --git a/bval-tck/work-tests-suite.xml b/bval-tck/work-tests-suite.xml
index 3bb8b11..8bc248c 100644
--- a/bval-tck/work-tests-suite.xml
+++ b/bval-tck/work-tests-suite.xml
@@ -21,7 +21,8 @@ think to add -Dvalidation.provider=org.apache.bval.jsr.ApacheValidationProvider
 <suite name="tmp" verbose="1">
   <test name="tmp">
     <classes>
-      <class name="org.hibernate.beanvalidation.tck.tests.xmlconfiguration.groupconversion.containerelement.XmlBasedContainerElementGroupConversionValidationTest"/>
+<!--       <class name="org.hibernate.beanvalidation.tck.tests.xmlconfiguration.groupconversion.containerelement.XmlBasedContainerElementGroupConversionValidationTest"/> -->
+      <class name="org.hibernate.beanvalidation.tck.tests.validation.CustomPropertyPathTest"/>
 <!--
       <class name="org.hibernate.beanvalidation.tck.tests.util.ConstraintViolationAssertTest"/>
 -->


[5/6] bval git commit: clean up no-longer-used code from JSR module

Posted by mb...@apache.org.
http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/BeanDescriptorImpl.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/BeanDescriptorImpl.java b/bval-jsr/src/main/java/org/apache/bval/jsr/BeanDescriptorImpl.java
deleted file mode 100644
index 9d0c32a..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/BeanDescriptorImpl.java
+++ /dev/null
@@ -1,916 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.Validate;
-import org.apache.bval.jsr.groups.Group;
-import org.apache.bval.jsr.groups.GroupConversionDescriptorImpl;
-import org.apache.bval.jsr.util.ClassHelper;
-import org.apache.bval.jsr.xml.AnnotationIgnores;
-import org.apache.bval.model.Features;
-import org.apache.bval.model.Features.Bean;
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.MetaConstructor;
-import org.apache.bval.model.MetaMethod;
-import org.apache.bval.model.MetaParameter;
-import org.apache.bval.model.MetaProperty;
-import org.apache.bval.model.Validation;
-import org.apache.bval.util.AccessStrategy;
-import org.apache.bval.util.reflection.Reflection;
-import org.apache.commons.weaver.privilizer.Privilizing;
-import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
-
-import javax.validation.Constraint;
-import javax.validation.ConstraintDeclarationException;
-import javax.validation.ConstraintTarget;
-import javax.validation.Valid;
-import javax.validation.groups.ConvertGroup;
-import javax.validation.metadata.BeanDescriptor;
-import javax.validation.metadata.ConstraintDescriptor;
-import javax.validation.metadata.ConstructorDescriptor;
-import javax.validation.metadata.ExecutableDescriptor;
-import javax.validation.metadata.GroupConversionDescriptor;
-import javax.validation.metadata.MethodDescriptor;
-import javax.validation.metadata.MethodType;
-import javax.validation.metadata.ParameterDescriptor;
-import javax.validation.metadata.PropertyDescriptor;
-import javax.validation.metadata.ReturnValueDescriptor;
-import java.beans.Introspector;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
-
-/**
- * Description: Implements {@link BeanDescriptor}.<br/>
- */
-@Privilizing(@CallTo(Reflection.class))
-public class BeanDescriptorImpl extends ElementDescriptorImpl implements BeanDescriptor {
-    private static final CopyOnWriteArraySet<ConstraintValidation<?>> NO_CONSTRAINTS =
-        new CopyOnWriteArraySet<ConstraintValidation<?>>();
-    private static final Validation[] EMPTY_VALIDATION = new Validation[0];
-
-    /**
-     * The {@link ApacheFactoryContext} (not) used by this
-     * {@link BeanDescriptorImpl}
-     */
-    private final Set<ConstructorDescriptor> constrainedConstructors;
-    private final Set<MethodDescriptor> containedMethods;
-    private final ExecutableMeta meta;
-    private final Boolean isBeanConstrained;
-    private final Set<PropertyDescriptor> validatedProperties;
-
-    protected BeanDescriptorImpl(final ApacheFactoryContext factoryContext, final MetaBean metaBean) {
-        super(metaBean, metaBean.getBeanClass(), metaBean.getValidations());
-
-        Set<PropertyDescriptor> procedureDescriptors = metaBean.getFeature(Bean.PROPERTIES);
-        if (procedureDescriptors == null) {
-            procedureDescriptors = new HashSet<PropertyDescriptor>();
-            for (final MetaProperty prop : metaBean.getProperties()) {
-                if (prop.getValidations().length > 0
-                    || (prop.getMetaBean() != null || prop.getFeature(Features.Property.REF_CASCADE) != null)) {
-                    procedureDescriptors.add(getPropertyDescriptor(prop));
-                }
-            }
-            procedureDescriptors = metaBean.initFeature(Bean.PROPERTIES, procedureDescriptors);
-        }
-
-        ExecutableMeta executables = metaBean.getFeature(Bean.EXECUTABLES);
-        if (executables == null) { // caching the result of it is important to avoid to compute it for each Validator
-            executables = new ExecutableMeta(factoryContext, metaBean, getConstraintDescriptors());
-            executables = metaBean.initFeature(Bean.EXECUTABLES, executables);
-        }
-
-        validatedProperties = Collections.unmodifiableSet(procedureDescriptors);
-        meta = executables;
-        isBeanConstrained = meta.isBeanConstrained;
-        containedMethods = toConstrained(meta.methodConstraints.values());
-        constrainedConstructors = toConstrained(meta.contructorConstraints.values());
-    }
-
-    private static void addGroupConvertion(final MetaProperty prop, final PropertyDescriptorImpl edesc) {
-        boolean fieldFound = false;
-        boolean methodFound = false;
-        Class<?> current = prop.getParentMetaBean().getBeanClass();
-        while (current != null && current != Object.class && (!methodFound || !fieldFound)) {
-            if (!fieldFound) {
-                final Field field = Reflection.getDeclaredField(current, prop.getName());
-                if (field != null) {
-                    processConvertGroup(edesc, field);
-                    fieldFound = true;
-                }
-            }
-            if (!methodFound) {
-                final String name = Character.toUpperCase(prop.getName().charAt(0)) + prop.getName().substring(1);
-                Method m = Reflection.getDeclaredMethod(current, "get" + name);
-                if (m == null) {
-                    final Method isAccessor = Reflection.getDeclaredMethod(current, "is" + name);
-                    if (isAccessor != null && boolean.class.equals(isAccessor.getReturnType())) {
-                        m = isAccessor;
-                    }
-                }
-                if (m != null) {
-                    processConvertGroup(edesc, m);
-                    methodFound = true;
-                }
-            }
-            current = current.getSuperclass();
-        }
-
-        final Collection<Annotation> annotations = prop.getFeature(JsrFeatures.Property.ANNOTATIONS_TO_PROCESS);
-        if (annotations != null) {
-            for (final Annotation a : annotations) {
-                if (ConvertGroup.List.class.isInstance(a)) {
-                    for (final ConvertGroup convertGroup : ConvertGroup.List.class.cast(a).value()) {
-                        edesc.addGroupConversion(new GroupConversionDescriptorImpl(new Group(convertGroup.from()),
-                            new Group(convertGroup.to())));
-                    }
-                }
-                if (ConvertGroup.class.isInstance(a)) {
-                    final ConvertGroup convertGroup = ConvertGroup.class.cast(a);
-                    edesc.addGroupConversion(new GroupConversionDescriptorImpl(new Group(convertGroup.from()),
-                        new Group(convertGroup.to())));
-                }
-            }
-            annotations.clear();
-        }
-        if (!edesc.getGroupConversions().isEmpty() && !edesc.isCascaded()) {
-            throw new ConstraintDeclarationException("@Valid is needed for group conversion");
-        }
-    }
-
-    private static void processConvertGroup(final ElementDescriptorImpl edesc, final AccessibleObject accessible) {
-        final ConvertGroup.List convertGroupList = accessible.getAnnotation(ConvertGroup.List.class);
-        if (convertGroupList != null) {
-            for (final ConvertGroup convertGroup : convertGroupList.value()) {
-                edesc.addGroupConversion(
-                    new GroupConversionDescriptorImpl(new Group(convertGroup.from()), new Group(convertGroup.to())));
-            }
-        }
-        final ConvertGroup convertGroup = accessible.getAnnotation(ConvertGroup.class);
-        if (convertGroup != null) {
-            edesc.addGroupConversion(
-                new GroupConversionDescriptorImpl(new Group(convertGroup.from()), new Group(convertGroup.to())));
-        }
-    }
-
-    /**
-     * Returns true if the bean involves validation:
-     * <ul>
-     * <li>a constraint is hosted on the bean itself</li>
-     * <li>a constraint is hosted on one of the bean properties, OR</li>
-     * <li>a bean property is marked for cascade (<code>@Valid</code>)</li>
-     * </ul>
-     *
-     * @return true if the bean involves validation
-     */
-    @Override
-    public boolean isBeanConstrained() {
-        return isBeanConstrained;
-    }
-
-    /**
-     * Return the property level constraints for a given propertyName or {@code null} if
-     * either the property does not exist or has no constraint. The returned
-     * object (and associated objects including ConstraintDescriptors) are
-     * immutable.
-     *
-     * @param propertyName property evaluated
-     */
-    @Override
-    public PropertyDescriptor getConstraintsForProperty(String propertyName) {
-        if (propertyName == null || propertyName.trim().length() == 0) {
-            throw new IllegalArgumentException("propertyName cannot be null or empty");
-        }
-        final MetaProperty prop = metaBean.getProperty(propertyName);
-        if (prop == null) {
-            return null;
-        }
-        // If no constraints and not cascaded, return null
-        if (prop.getValidations().length == 0 && prop.getFeature(Features.Property.REF_CASCADE) == null) {
-            return null;
-        }
-        return getPropertyDescriptor(prop);
-    }
-
-    private PropertyDescriptor getPropertyDescriptor(final MetaProperty prop) {
-        PropertyDescriptorImpl edesc = prop.getFeature(JsrFeatures.Property.PropertyDescriptor);
-        if (edesc == null) {
-            edesc = new PropertyDescriptorImpl(prop);
-            addGroupConvertion(prop, edesc);
-            prop.putFeature(JsrFeatures.Property.PropertyDescriptor, edesc);
-        }
-        return edesc;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @return the property descriptors having at least a constraint defined
-     */
-    @Override
-    public Set<PropertyDescriptor> getConstrainedProperties() {
-        return Collections.unmodifiableSet(validatedProperties);
-    }
-
-    public MethodDescriptor getInternalConstraintsForMethod(final String methodName, final Class<?>... parameterTypes) {
-        if (methodName == null) {
-            throw new IllegalArgumentException("Method name can't be null");
-        }
-        return meta.methodConstraints.get(methodName + Arrays.toString(parameterTypes));
-    }
-
-    @Override
-    public MethodDescriptor getConstraintsForMethod(final String methodName, final Class<?>... parameterTypes) {
-        if (methodName == null) {
-            throw new IllegalArgumentException("Method name can't be null");
-        }
-        final MethodDescriptor methodDescriptor =
-            meta.methodConstraints.get(methodName + Arrays.toString(parameterTypes));
-        if (methodDescriptor != null
-            && (methodDescriptor.hasConstrainedParameters() || methodDescriptor.hasConstrainedReturnValue())) {
-            return methodDescriptor;
-        }
-        return null;
-    }
-
-    @Override
-    public Set<MethodDescriptor> getConstrainedMethods(MethodType methodType, MethodType... methodTypes) {
-        final Set<MethodDescriptor> desc = new HashSet<MethodDescriptor>();
-        desc.addAll(filter(containedMethods, methodType));
-        if (methodTypes != null) {
-            for (final MethodType type : methodTypes) {
-                desc.addAll(filter(containedMethods, type));
-            }
-        }
-        return desc;
-    }
-
-    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())));
-
-            switch (type) {
-            case GETTER:
-                if (getter) {
-                    list.add(d);
-                }
-                break;
-
-            case NON_GETTER:
-                if (!getter) {
-                    list.add(d);
-                }
-            }
-        }
-        return list;
-    }
-
-    @Override
-    public ConstructorDescriptor getConstraintsForConstructor(final Class<?>... parameterTypes) {
-        final ConstructorDescriptor descriptor = meta.contructorConstraints.get(Arrays.toString(parameterTypes));
-        if (descriptor != null && (descriptor.hasConstrainedParameters() || descriptor.hasConstrainedReturnValue())) {
-            return descriptor;
-        }
-        return null;
-    }
-
-    @Override
-    public Set<ConstructorDescriptor> getConstrainedConstructors() {
-        return constrainedConstructors;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
-        return "BeanDescriptorImpl{" + "returnType=" + 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);
-    }
-
-    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 Boolean isBeanConstrained = null;
-
-        private ExecutableMeta(final ApacheFactoryContext factoryContext, final MetaBean metaBean1,
-            final Collection<ConstraintDescriptor<?>> constraintDescriptors) {
-            this.metaBean = metaBean1;
-            this.factoryContext = factoryContext;
-            this.annotationProcessor = new AnnotationProcessor(factoryContext.getFactory());
-
-            buildExecutableDescriptors();
-
-            boolean hasAnyContraints;
-            if (constraintDescriptors.isEmpty()) {
-                hasAnyContraints = false;
-                for (final MetaProperty mprop : metaBean.getProperties()) {
-                    if (!getConstraintDescriptors(mprop.getValidations()).isEmpty()) {
-                        hasAnyContraints = true;
-                        break;
-                    }
-                }
-            } else {
-                hasAnyContraints = true;
-            }
-
-            // cache isBeanConstrained
-            if (hasAnyContraints) {
-                isBeanConstrained = true;
-            } else {
-                isBeanConstrained = false;
-                for (final MetaProperty mprop : metaBean.getProperties()) {
-                    if (mprop.getMetaBean() != null || mprop.getFeature(Features.Property.REF_CASCADE) != null) {
-                        isBeanConstrained = true;
-                        break;
-                    }
-                }
-            }
-        }
-
-        private void buildConstructorConstraints() throws InvocationTargetException, IllegalAccessException {
-            for (final Constructor<?> cons : Reflection.getDeclaredConstructors(metaBean.getBeanClass())) {
-                final ConstructorDescriptorImpl consDesc = new ConstructorDescriptorImpl(metaBean, EMPTY_VALIDATION);
-                contructorConstraints.put(Arrays.toString(cons.getParameterTypes()), consDesc);
-
-                final List<String> names = factoryContext.getParameterNameProvider().getParameterNames(cons);
-                final boolean isInnerClass = cons.getDeclaringClass().getEnclosingClass() != null
-                    && !Modifier.isStatic(cons.getDeclaringClass().getModifiers());
-
-                final AnnotationIgnores annotationIgnores = factoryContext.getFactory().getAnnotationIgnores();
-
-                {
-                    final Annotation[][] paramsAnnos = cons.getParameterAnnotations();
-
-                    int idx = 0;
-                    if (isInnerClass) { // paramsAnnos.length = parameterTypes.length - 1 in this case
-                        final ParameterDescriptorImpl paramDesc =
-                            new ParameterDescriptorImpl(metaBean, EMPTY_VALIDATION, names.get(idx));
-                        consDesc.getParameterDescriptors().add(paramDesc);
-                        idx++;
-                    }
-
-                    for (final Annotation[] paramAnnos : paramsAnnos) {
-                        if (annotationIgnores.isIgnoreAnnotationOnParameter(cons, idx)) {
-                            consDesc.getParameterDescriptors()
-                                .add(new ParameterDescriptorImpl(metaBean, EMPTY_VALIDATION, names.get(idx)));
-                        } else if (cons.getParameterTypes().length > idx) {
-                            ParameterAccess access = new ParameterAccess(cons.getParameterTypes()[idx], idx);
-                            consDesc.addValidations(
-                                processAnnotations(consDesc, paramAnnos, access, idx, names.get(idx)).getValidations());
-                        } // else anonymous class so that's fine
-                        idx++;
-                    }
-
-                    if (!annotationIgnores.isIgnoreAnnotations(cons)) {
-                        for (final Annotation anno : cons.getAnnotations()) {
-                            if (Valid.class.isInstance(anno)) {
-                                consDesc.setCascaded(true);
-                            } else {
-                                processAnnotations(null, consDesc, cons.getDeclaringClass(), anno);
-                            }
-                        }
-                    }
-                }
-
-                if (annotationIgnores.isIgnoreAnnotationOnCrossParameter(cons)
-                    && consDesc.getCrossParameterDescriptor() != null) {
-                    consDesc.setCrossParameterDescriptor(null);
-                }
-                if (annotationIgnores.isIgnoreAnnotationOnReturn(cons) && consDesc.getReturnValueDescriptor() != null) {
-                    consDesc.setReturnValueDescriptor(null);
-                }
-
-                final MetaConstructor metaConstructor = metaBean.getConstructor(cons);
-                if (metaConstructor != null) {
-                    for (final Annotation anno : metaConstructor.getAnnotations()) {
-                        if (Valid.class.isInstance(anno)) {
-                            consDesc.setCascaded(true);
-                        } else {
-                            processAnnotations(null, consDesc, cons.getDeclaringClass(), anno);
-                        }
-                    }
-
-                    // parameter validations
-                    final Collection<MetaParameter> paramsAnnos = metaConstructor.getParameters();
-                    for (final MetaParameter paramAnnos : paramsAnnos) {
-                        final int idx = paramAnnos.getIndex();
-                        final ParameterAccess access = new ParameterAccess(cons.getParameterTypes()[idx], idx);
-                        processAnnotations(consDesc, paramAnnos.getAnnotations(), access, idx, names.get(idx));
-                    }
-                }
-
-                if (consDesc.getGroupConversions().isEmpty() || consDesc.isCascaded()) {
-                    ensureNotNullDescriptors(cons.getDeclaringClass(), consDesc);
-                } else {
-                    throw new ConstraintDeclarationException("@Valid is needed to define a group conversion");
-                }
-            }
-        }
-
-        private void ensureNotNullDescriptors(final Class<?> returnType, final InvocableElementDescriptor consDesc) {
-            // can't be null
-            if (consDesc.getCrossParameterDescriptor() == null) {
-                consDesc.setCrossParameterDescriptor(new CrossParameterDescriptorImpl(metaBean, NO_CONSTRAINTS));
-            }
-            if (consDesc.getReturnValueDescriptor() == null) {
-                consDesc.setReturnValueDescriptor(
-                    new ReturnValueDescriptorImpl(metaBean, returnType, NO_CONSTRAINTS, consDesc.isCascaded()));
-            }
-            // enforce it since ReturnValueDescriptor can be created before cascaded is set to true
-            final ReturnValueDescriptorImpl returnValueDescriptor =
-                ReturnValueDescriptorImpl.class.cast(consDesc.getReturnValueDescriptor());
-            returnValueDescriptor.setCascaded(consDesc.isCascaded());
-            if (returnValueDescriptor.getGroupConversions().isEmpty()) {
-                // loop to not forget to map calling addGroupConversion()
-                for (final GroupConversionDescriptor c : consDesc.getGroupConversions()) {
-                    returnValueDescriptor.addGroupConversion(c);
-                }
-            }
-        }
-
-        private void processAnnotations(final Method mtd, final InvocableElementDescriptor consDesc,
-            final Class<?> clazz, final Annotation anno) throws InvocationTargetException, IllegalAccessException {
-            if (mtd == null || !factoryContext.getFactory().getAnnotationIgnores().isIgnoreAnnotationOnReturn(mtd)) {
-                final ReturnAccess returnAccess = new ReturnAccess(clazz);
-                final AppendValidationToList validations = new AppendValidationToList();
-                processAnnotation(anno, consDesc, returnAccess, validations);
-                final List<ConstraintValidation<?>> list =
-                    removeFromListValidationAppliesTo(validations.getValidations(), ConstraintTarget.PARAMETERS);
-                consDesc.addValidations(list);
-
-                ReturnValueDescriptorImpl returnValueDescriptor =
-                    ReturnValueDescriptorImpl.class.cast(consDesc.getReturnValueDescriptor());
-                if (consDesc.getReturnValueDescriptor() == null) {
-                    returnValueDescriptor = new ReturnValueDescriptorImpl(metaBean, clazz, list, consDesc.isCascaded());
-                    consDesc.setReturnValueDescriptor(returnValueDescriptor);
-                } else {
-                    returnValueDescriptor.getMutableConstraintDescriptors().addAll(list);
-                }
-            }
-
-            if (mtd == null
-                || !factoryContext.getFactory().getAnnotationIgnores().isIgnoreAnnotationOnCrossParameter(mtd)) {
-                final ParametersAccess parametersAccess = new ParametersAccess();
-                final AppendValidationToList validations = new AppendValidationToList();
-                processAnnotation(anno, consDesc, parametersAccess, validations);
-                final List<ConstraintValidation<?>> list =
-                    removeFromListValidationAppliesTo(validations.getValidations(), ConstraintTarget.RETURN_VALUE);
-                consDesc.addValidations(list);
-                if (consDesc.getCrossParameterDescriptor() == null) {
-                    consDesc.setCrossParameterDescriptor(new CrossParameterDescriptorImpl(metaBean, list));
-                } else {
-                    CrossParameterDescriptorImpl.class.cast(consDesc.getCrossParameterDescriptor())
-                        .getMutableConstraintDescriptors().addAll(list);
-                }
-            }
-        }
-
-        private static List<ConstraintValidation<?>> removeFromListValidationAppliesTo(
-            final List<ConstraintValidation<?>> validations, final ConstraintTarget constraint) {
-            final Iterator<ConstraintValidation<?>> i = validations.iterator();
-            while (i.hasNext()) {
-                if (constraint.equals(i.next().getValidationAppliesTo())) {
-                    i.remove();
-                }
-            }
-            return validations;
-        }
-
-        private void buildMethodConstraints() throws InvocationTargetException, IllegalAccessException {
-
-            final Class<?> current = metaBean.getBeanClass();
-            final List<Class<?>> classHierarchy =
-                ClassHelper.fillFullClassHierarchyAsList(new ArrayList<Class<?>>(), current);
-            classHierarchy.remove(current);
-
-            for (final Method method : Reflection.getDeclaredMethods(current)) {
-                if (Modifier.isStatic(method.getModifiers()) || method.isSynthetic()) {
-                    continue;
-                }
-
-                final boolean propertyAccessor = method.getParameterTypes().length == 0
-                    && (method.getName().startsWith("get") && !Void.TYPE.equals(method.getReturnType())
-                        || method.getName().startsWith("is") && Boolean.TYPE.equals(method.getReturnType()));
-
-                final String key = method.getName() + Arrays.toString(method.getParameterTypes());
-                MethodDescriptorImpl methodDesc = MethodDescriptorImpl.class.cast(methodConstraints.get(key));
-                if (methodDesc == null) {
-                    methodDesc = new MethodDescriptorImpl(metaBean, EMPTY_VALIDATION, method);
-                    methodConstraints.put(key, methodDesc);
-                } else {
-                    continue;
-                }
-
-                final Collection<Method> parents = new ArrayList<Method>();
-                for (final Class<?> clazz : classHierarchy) {
-                    final Method overridden =
-                        Reflection.getDeclaredMethod(clazz, method.getName(), method.getParameterTypes());
-                    if (overridden != null) {
-                        parents.add(overridden);
-                        processMethod(overridden, methodDesc);
-                    }
-                }
-
-                processMethod(method, methodDesc);
-
-                ensureNotNullDescriptors(method.getReturnType(), methodDesc);
-
-                if (parents != null) {
-                    if (parents.size() > 1) {
-                        for (final Method parent : parents) {
-                            final MethodDescriptor parentDec =
-                                factoryContext.getValidator().getConstraintsForClass(parent.getDeclaringClass())
-                                    .getConstraintsForMethod(parent.getName(), parent.getParameterTypes());
-                            if (parentDec != null) {
-                                ensureNoParameterConstraint(InvocableElementDescriptor.class.cast(parentDec),
-                                    "Parameter constraints can't be defined for parallel interfaces/parents");
-                            } else {
-                                ensureMethodDoesntDefineParameterConstraint(methodDesc);
-                            }
-                            ensureNoReturnValueAddedInChild(methodDesc.getReturnValueDescriptor(), parentDec,
-                                "Return value constraints should be the same for parent and children");
-                        }
-                    } else if (parents.size() == 1) {
-                        final Method parent = parents.iterator().next();
-                        final MethodDescriptor parentDesc =
-                            factoryContext.getValidator().getConstraintsForClass(parent.getDeclaringClass())
-                                .getConstraintsForMethod(parent.getName(), parent.getParameterTypes());
-                        ensureNoReturnValueAddedInChild(methodDesc.getReturnValueDescriptor(), parentDesc,
-                            "Return value constraints should be at least the same for parent and children");
-
-                        if (parentDesc == null) {
-                            ensureMethodDoesntDefineParameterConstraint(methodDesc);
-                        } else {
-                            final Iterator<ParameterDescriptor> parentPd =
-                                parentDesc.getParameterDescriptors().iterator();
-                            for (final ParameterDescriptor pd : methodDesc.getParameterDescriptors()) {
-                                final ParameterDescriptor next = parentPd.next();
-                                if (pd.getConstraintDescriptors().size() != next.getConstraintDescriptors().size()) {
-                                    throw new ConstraintDeclarationException(
-                                        "child shouldn't get more constraint than parent");
-                                }
-                                if (pd.isCascaded() != next.isCascaded()) { // @Valid
-                                    throw new ConstraintDeclarationException(
-                                        "child shouldn't get more constraint than parent");
-                                }
-                            }
-                        }
-                    }
-
-                    final Class<?>[] interfaces = method.getDeclaringClass().getInterfaces();
-                    final Collection<Method> itfWithThisMethod = new ArrayList<Method>();
-                    for (final Class<?> i : interfaces) {
-                        final Method m = Reflection.getDeclaredMethod(i, method.getName(), method.getParameterTypes());
-                        if (m != null) {
-                            itfWithThisMethod.add(m);
-                        }
-                    }
-                    if (itfWithThisMethod.size() > 1) {
-                        for (final Method m : itfWithThisMethod) {
-                            ensureNoConvertGroup(m, "ConvertGroup can't be used in parallel interfaces");
-                        }
-                    } else if (itfWithThisMethod.size() == 1) {
-                        ensureNoConvertGroup(itfWithThisMethod.iterator().next(),
-                            "ConvertGroup can't be used in interface AND parent class");
-                    }
-
-                    int returnValid = 0;
-                    if (method.getAnnotation(Valid.class) != null) {
-                        returnValid++;
-                    }
-                    for (final Class<?> clazz : classHierarchy) {
-                        final Method overridden =
-                            Reflection.getDeclaredMethod(clazz, method.getName(), method.getParameterTypes());
-                        if (overridden != null) {
-                            if (overridden.getAnnotation(Valid.class) != null) {
-                                returnValid++;
-                            }
-                        }
-                    }
-                    if (returnValid > 1
-                        && !(interfaces.length == returnValid && method.getAnnotation(Valid.class) == null)) {
-                        throw new ConstraintDeclarationException(
-                            "@Valid on returned value can't be set more than once");
-                    }
-                }
-
-                if (propertyAccessor) {
-                    final MetaProperty prop =
-                        metaBean.getProperty(Introspector.decapitalize(method.getName().substring(3)));
-                    if (prop != null && prop.getFeature(Features.Property.REF_CASCADE) != null) {
-                        methodDesc.setCascaded(true);
-                    }
-                }
-
-                if (!methodDesc.getGroupConversions().isEmpty() && !methodDesc.isCascaded()) {
-                    throw new ConstraintDeclarationException("@Valid is needed to define a group conversion");
-                }
-            }
-
-            for (final Class<?> parent : classHierarchy) {
-                final BeanDescriptorImpl desc =
-                    BeanDescriptorImpl.class.cast(factoryContext.getValidator().getConstraintsForClass(parent));
-                for (final String s : desc.meta.methodConstraints.keySet()) {
-                    if (!methodConstraints.containsKey(s)) { // method from the parent only
-                        methodConstraints.put(s, desc.meta.methodConstraints.get(s));
-                    }
-                }
-            }
-        }
-
-        private void ensureMethodDoesntDefineParameterConstraint(MethodDescriptorImpl methodDesc) {
-            for (final ParameterDescriptor pd : methodDesc.getParameterDescriptors()) {
-                if (!pd.getConstraintDescriptors().isEmpty()) {
-                    throw new ConstraintDeclarationException("child shouldn't get more constraint than parent");
-                }
-                if (pd.isCascaded()) { // @Valid
-                    throw new ConstraintDeclarationException("child shouldn't get more constraint than parent");
-                }
-            }
-        }
-
-        private void ensureNoReturnValueAddedInChild(final ReturnValueDescriptor returnValueDescriptor,
-            final MethodDescriptor parentMtdDesc, final String msg) {
-            if (parentMtdDesc == null) {
-                return;
-            }
-            final ReturnValueDescriptor parentReturnDesc = parentMtdDesc.getReturnValueDescriptor();
-            if (parentReturnDesc.isCascaded() && !returnValueDescriptor.isCascaded() || parentReturnDesc
-                .getConstraintDescriptors().size() > returnValueDescriptor.getConstraintDescriptors().size()) {
-                throw new ConstraintDeclarationException(msg);
-            }
-        }
-
-        private static void ensureNoParameterConstraint(final InvocableElementDescriptor constraintsForMethod,
-            final String msg) {
-            for (final ParameterDescriptor parameterDescriptor : constraintsForMethod.getParameterDescriptors()) {
-                if (!parameterDescriptor.getConstraintDescriptors().isEmpty() || parameterDescriptor.isCascaded()) {
-                    throw new ConstraintDeclarationException(msg);
-                }
-            }
-        }
-
-        private static void ensureNoConvertGroup(final Method method, final String msg) {
-            for (final Annotation[] annotations : method.getParameterAnnotations()) {
-                for (final Annotation a : annotations) {
-                    if (ConvertGroup.class.isInstance(a)) {
-                        throw new ConstraintDeclarationException(msg);
-                    }
-                }
-            }
-            if (method.getAnnotation(ConvertGroup.class) != null) {
-                throw new ConstraintDeclarationException(msg);
-            }
-        }
-
-        private void processMethod(final Method method, final MethodDescriptorImpl methodDesc)
-            throws InvocationTargetException, IllegalAccessException {
-            final AnnotationIgnores annotationIgnores = factoryContext.getFactory().getAnnotationIgnores();
-
-            { // reflection
-                if (!annotationIgnores.isIgnoreAnnotations(method)) {
-                    // return value validations and/or cross-parameter validation
-                    for (final Annotation anno : method.getAnnotations()) {
-                        if (anno instanceof Valid || anno instanceof Validate) {
-                            methodDesc.setCascaded(true);
-                        } else {
-                            processAnnotations(method, methodDesc, method.getReturnType(), anno);
-                        }
-                    }
-                }
-
-                // parameter validations
-                final Annotation[][] paramsAnnos = method.getParameterAnnotations();
-                int idx = 0;
-                final List<String> names = factoryContext.getParameterNameProvider().getParameterNames(method);
-                for (final Annotation[] paramAnnos : paramsAnnos) {
-                    if (annotationIgnores.isIgnoreAnnotationOnParameter(method, idx)) {
-                        final ParameterDescriptorImpl parameterDescriptor =
-                            new ParameterDescriptorImpl(metaBean, EMPTY_VALIDATION, names.get(idx));
-                        parameterDescriptor.setIndex(idx);
-                        methodDesc.getParameterDescriptors().add(parameterDescriptor);
-                    } else {
-                        final ParameterAccess access = new ParameterAccess(method.getParameterTypes()[idx], idx);
-                        processAnnotations(methodDesc, paramAnnos, access, idx, names.get(idx));
-                    }
-                    idx++;
-                }
-            }
-
-            if (annotationIgnores.isIgnoreAnnotationOnCrossParameter(method)
-                && methodDesc.getCrossParameterDescriptor() != null) {
-                methodDesc.setCrossParameterDescriptor(null);
-            }
-            if (annotationIgnores.isIgnoreAnnotationOnReturn(method) && methodDesc.getReturnValueDescriptor() != null) {
-                methodDesc.setReturnValueDescriptor(null);
-            }
-
-            final MetaMethod metaMethod = metaBean.getMethod(method);
-            if (metaMethod != null) {
-                for (final Annotation anno : metaMethod.getAnnotations()) {
-                    if (anno instanceof Valid) {
-                        methodDesc.setCascaded(true);
-                    } else {
-                        // set first param as null to force it to be read
-                        processAnnotations(null, methodDesc, method.getReturnType(), anno);
-                    }
-                }
-
-                // parameter validations
-                final Collection<MetaParameter> paramsAnnos = metaMethod.getParameters();
-                final List<String> names = factoryContext.getParameterNameProvider().getParameterNames(method);
-                for (final MetaParameter paramAnnos : paramsAnnos) {
-                    final int idx = paramAnnos.getIndex();
-                    final ParameterAccess access = new ParameterAccess(method.getParameterTypes()[idx], idx);
-                    processAnnotations(methodDesc, paramAnnos.getAnnotations(), access, idx, names.get(idx));
-                }
-            }
-        }
-
-        private AppendValidationToList processAnnotations(InvocableElementDescriptor methodDesc,
-            Annotation[] paramAnnos, AccessStrategy access, int idx, String name)
-            throws InvocationTargetException, IllegalAccessException {
-            final AppendValidationToList validations = new AppendValidationToList();
-            boolean cascaded = false;
-
-            Group[] from = null;
-            Group[] to = null;
-
-            for (final Annotation anno : paramAnnos) {
-                if (anno instanceof Valid || anno instanceof Validate) {
-                    cascaded = true;
-                } else if (ConvertGroup.class.isInstance(anno)) {
-                    final ConvertGroup cg = ConvertGroup.class.cast(anno);
-                    from = new Group[] { new Group(cg.from()) };
-                    to = new Group[] { new Group(cg.to()) };
-                } else if (ConvertGroup.List.class.isInstance(anno)) {
-                    final ConvertGroup.List cgl = ConvertGroup.List.class.cast(anno);
-                    final ConvertGroup[] groups = cgl.value();
-                    from = new Group[groups.length];
-                    to = new Group[groups.length];
-                    for (int i = 0; i < to.length; i++) {
-                        from[i] = new Group(groups[i].from());
-                        to[i] = new Group(groups[i].to());
-                    }
-                } else {
-                    processConstraint(anno, methodDesc, access, validations);
-                }
-            }
-
-            ParameterDescriptorImpl paramDesc = null;
-            for (final ParameterDescriptor pd : methodDesc.getParameterDescriptors()) {
-                if (pd.getIndex() == idx) {
-                    paramDesc = ParameterDescriptorImpl.class.cast(pd);
-                }
-            }
-
-            if (paramDesc == null) {
-                paramDesc = new ParameterDescriptorImpl(Class.class.cast(access.getJavaType()), // set from getParameterTypes() so that's a Class<?>
-                    validations.getValidations().toArray(new Validation[validations.getValidations().size()]), name);
-                paramDesc.setIndex(idx);
-                final List<ParameterDescriptor> parameterDescriptors = methodDesc.getParameterDescriptors();
-                if (!parameterDescriptors.contains(paramDesc)) {
-                    parameterDescriptors.add(paramDesc);
-                }
-                paramDesc.setCascaded(cascaded);
-            } else {
-                final List<ConstraintValidation<?>> newValidations = validations.getValidations();
-                for (final ConstraintValidation<?> validation : newValidations) { // don't add it if exactly the same is already here
-                    boolean alreadyHere = false;
-                    for (final ConstraintDescriptor<?> existing : paramDesc.getMutableConstraintDescriptors()) {
-                        if (existing.getAnnotation().annotationType()
-                            .equals(validation.getAnnotation().annotationType())) { // TODO: make it a bit finer
-                            alreadyHere = true;
-                            break;
-                        }
-                    }
-                    if (!alreadyHere) {
-                        paramDesc.getMutableConstraintDescriptors().add(validation);
-                    }
-                }
-                if (cascaded) {
-                    paramDesc.setCascaded(true);
-                } // else keep previous config
-            }
-            if (from != null) {
-                if (paramDesc.isCascaded()) {
-                    for (int i = 0; i < from.length; i++) {
-                        paramDesc.addGroupConversion(new GroupConversionDescriptorImpl(from[i], to[i]));
-                    }
-                } else {
-                    throw new ConstraintDeclarationException("Group conversion is only relevant for @Valid cases");
-                }
-            }
-            return validations;
-        }
-
-        private <A extends Annotation> void processAnnotation(final A annotation, final InvocableElementDescriptor desc,
-            final AccessStrategy access, final AppendValidation validations)
-            throws InvocationTargetException, IllegalAccessException {
-            if (annotation.annotationType().getName().startsWith("java.lang.annotation.")) {
-                return;
-            }
-
-            if (annotation instanceof Valid || annotation instanceof Validate) {
-                desc.setCascaded(true);
-            } else if (ConvertGroup.class.isInstance(annotation) && ReturnAccess.class.isInstance(access)) { // access is just tested to ensure to not read it twice with cross parameter
-                final ConvertGroup cg = ConvertGroup.class.cast(annotation);
-                desc.addGroupConversion(new GroupConversionDescriptorImpl(new Group(cg.from()), new Group(cg.to())));
-            } else if (ConvertGroup.List.class.isInstance(annotation) && ReturnAccess.class.isInstance(access)) {
-                final ConvertGroup.List cgl = ConvertGroup.List.class.cast(annotation);
-                for (final ConvertGroup cg : cgl.value()) {
-                    desc.addGroupConversion(
-                        new GroupConversionDescriptorImpl(new Group(cg.from()), new Group(cg.to())));
-                }
-            } else {
-                processConstraint(annotation, desc, access, validations);
-            }
-        }
-
-        private <A extends Annotation> void processConstraint(final A annotation, final InvocableElementDescriptor desc,
-            final AccessStrategy access, final AppendValidation validations)
-            throws IllegalAccessException, InvocationTargetException {
-            final Constraint vcAnno = annotation.annotationType().getAnnotation(Constraint.class);
-            if (vcAnno == null) {
-                /*
-                 * Multi-valued constraints
-                 */
-                final ConstraintAnnotationAttributes.Worker<? extends Annotation> worker =
-                    ConstraintAnnotationAttributes.VALUE.analyze(annotation.annotationType());
-                if (worker.isValid()) {
-                    final Object value = worker.read(annotation);
-                    if (Annotation[].class.isInstance(value)) {
-                        final Annotation[] children = Annotation[].class.cast(value);
-                        for (Annotation child : children) {
-                            processAnnotation(child, desc, access, validations); // recursion
-                        }
-                    }
-                }
-            } else {
-                annotationProcessor.processAnnotation(annotation, null,
-                    Reflection.primitiveToWrapper((Class<?>) access.getJavaType()), access, validations, true);
-            }
-        }
-
-        private void buildExecutableDescriptors() {
-            try {
-                buildMethodConstraints();
-                buildConstructorConstraints();
-            } catch (final Exception ex) {
-                if (RuntimeException.class.isInstance(ex)) {
-                    throw RuntimeException.class.cast(ex);
-                }
-                throw new IllegalArgumentException(ex.getMessage(), ex);
-            }
-        }
-    }
-}


[6/6] bval git commit: clean up no-longer-used code from JSR module

Posted by mb...@apache.org.
clean up no-longer-used code from JSR module


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

Branch: refs/heads/bv2
Commit: 92c64b3ceef1e18733d09f27405045bfbdec5a15
Parents: f1e8de1
Author: Matt Benson <mb...@apache.org>
Authored: Sun Feb 25 13:38:09 2018 -0600
Committer: Matt Benson <mb...@apache.org>
Committed: Sun Feb 25 13:38:09 2018 -0600

----------------------------------------------------------------------
 .../org/apache/bval/cdi/BValInterceptor.java    |   26 +-
 .../bval/jsr/AnnotationConstraintBuilder.java   |  402 ------
 .../apache/bval/jsr/AnnotationProcessor.java    |  315 -----
 .../apache/bval/jsr/ApacheFactoryContext.java   |   16 +-
 .../apache/bval/jsr/ApacheValidatorFactory.java |  260 +---
 .../org/apache/bval/jsr/AppendValidation.java   |   32 -
 .../bval/jsr/AppendValidationToBuilder.java     |   91 --
 .../apache/bval/jsr/AppendValidationToList.java |   45 -
 .../apache/bval/jsr/AppendValidationToMeta.java |   44 -
 .../apache/bval/jsr/BaseAppendValidation.java   |   79 --
 .../org/apache/bval/jsr/BeanDescriptorImpl.java |  916 -------------
 .../org/apache/bval/jsr/ClassValidator.java     | 1292 ------------------
 .../org/apache/bval/jsr/ConstraintCached.java   |    1 -
 .../bval/jsr/ConstraintDescriptorImpl.java      |  236 ----
 .../apache/bval/jsr/ConstraintFinderImpl.java   |  175 ---
 .../apache/bval/jsr/ConstraintValidation.java   |  605 --------
 .../bval/jsr/ConstraintValidationListener.java  |  251 ----
 .../jsr/ConstraintValidatorContextImpl.java     |  211 ---
 .../bval/jsr/ConstraintValidatorIdentity.java   |  128 --
 .../bval/jsr/ConstraintViolationImpl.java       |   10 +-
 .../bval/jsr/ConstructorDescriptorImpl.java     |   63 -
 .../bval/jsr/CrossParameterDescriptorImpl.java  |   35 -
 .../apache/bval/jsr/ElementDescriptorImpl.java  |  199 ---
 .../org/apache/bval/jsr/GraphBeanIdentity.java  |  105 --
 .../apache/bval/jsr/GroupValidationContext.java |  157 ---
 .../bval/jsr/GroupValidationContextImpl.java    |  403 ------
 .../jsr/IncompatiblePropertyValueException.java |   69 -
 .../bval/jsr/InvocableElementDescriptor.java    |  106 --
 .../java/org/apache/bval/jsr/JsrFeatures.java   |   69 -
 .../org/apache/bval/jsr/JsrMetaBeanFactory.java |  339 -----
 .../org/apache/bval/jsr/MethodDescriptor.java   |   40 -
 .../apache/bval/jsr/MethodDescriptorImpl.java   |   64 -
 .../org/apache/bval/jsr/ParameterAccess.java    |   96 --
 .../bval/jsr/ParameterDescriptorImpl.java       |   96 --
 .../org/apache/bval/jsr/ParametersAccess.java   |   46 -
 .../apache/bval/jsr/ProcedureDescriptor.java    |   50 -
 .../apache/bval/jsr/PropertyDescriptorImpl.java |   79 --
 .../java/org/apache/bval/jsr/ReturnAccess.java  |   76 --
 .../bval/jsr/ReturnValueDescriptorImpl.java     |   43 -
 .../bval/jsr/UnknownPropertyException.java      |   67 -
 .../jsr/descriptor/CascadableContainerD.java    |    1 +
 .../bval/jsr/descriptor/DescriptorManager.java  |    4 +
 .../bval/jsr/descriptor/GroupConversion.java    |   85 --
 .../bval/jsr/descriptor/MetadataReader.java     |    1 +
 .../apache/bval/jsr/groups/GroupConversion.java |   85 ++
 .../groups/GroupConversionDescriptorImpl.java   |   44 -
 .../bval/jsr/metadata/CompositeBuilder.java     |    2 +-
 .../apache/bval/jsr/metadata/DualBuilder.java   |    2 +-
 .../apache/bval/jsr/metadata/EmptyBuilder.java  |    2 +-
 .../bval/jsr/metadata/MetadataBuilder.java      |    2 +-
 .../bval/jsr/metadata/ReflectionBuilder.java    |    2 +-
 .../apache/bval/jsr/metadata/XmlBuilder.java    |    2 +-
 .../org/apache/bval/jsr/util/ClassHelper.java   |   61 -
 ...ementNodeBuilderCustomizableContextImpl.java |    1 -
 .../bval/jsr/util/EnumerationConverter.java     |   75 -
 .../jsr/util/NodeBuilderDefinedContextImpl.java |    4 +-
 .../jsr/util/ValidationContextTraversal.java    |  222 ---
 .../apache/bval/jsr/xml/AnnotationIgnores.java  |  202 ---
 .../org/apache/bval/jsr/xml/MetaConstraint.java |  123 --
 .../org/apache/bval/jsr/xml/SchemaManager.java  |    1 -
 .../jsr/ConstraintValidatorContextTest.java     |  112 --
 .../bval/jsr/groups/GroupSequenceTest.java      |   49 +-
 .../jsr/util/EnumerationConverterTestCase.java  |   43 -
 bval-tck/work-tests-suite.xml                   |    3 +-
 64 files changed, 138 insertions(+), 8327 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptor.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptor.java b/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptor.java
index 7bf7709..b5d2c8b 100644
--- a/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptor.java
+++ b/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptor.java
@@ -25,13 +25,11 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.EnumSet;
-import java.util.LinkedList;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.Stream;
 
 import javax.annotation.Priority;
 import javax.enterprise.inject.spi.AnnotatedConstructor;
@@ -53,8 +51,10 @@ import javax.validation.executable.ValidateOnExecution;
 import javax.validation.metadata.ConstructorDescriptor;
 import javax.validation.metadata.MethodDescriptor;
 
-import org.apache.bval.jsr.util.ClassHelper;
+import org.apache.bval.jsr.util.Methods;
 import org.apache.bval.jsr.util.Proxies;
+import org.apache.bval.util.reflection.Reflection;
+import org.apache.bval.util.reflection.Reflection.Interfaces;
 
 /**
  * Interceptor class for the {@link BValBinding} {@link InterceptorBinding}.
@@ -205,14 +205,10 @@ public class BValInterceptor implements Serializable {
             synchronized (this) {
                 methodConfig = methodConfiguration.get(method);
                 if (methodConfig == null) {
-                    final List<Class<?>> classHierarchy =
-                        ClassHelper.fillFullClassHierarchyAsList(new LinkedList<>(), targetClass);
-                    Collections.reverse(classHierarchy);
-
                     // search on method @ValidateOnExecution
                     ValidateOnExecution validateOnExecution = null;
                     ValidateOnExecution validateOnExecutionType = null;
-                    for (final Class<?> c : classHierarchy) {
+                    for (final Class<?> c : reverseHierarchy(targetClass)) {
                         final AnnotatedType<?> annotatedType = CDI.current().getBeanManager().createAnnotatedType(c);
                         AnnotatedMethod<?> annotatedMethod = null;
 
@@ -328,13 +324,13 @@ public class BValInterceptor implements Serializable {
     }
 
     private static boolean doValidMethod(final Method method, final Set<ExecutableType> config) {
-        return isGetter(method) ? config.contains(ExecutableType.GETTER_METHODS)
-            : config.contains(ExecutableType.NON_GETTER_METHODS);
+        return config
+            .contains(Methods.isGetter(method) ? ExecutableType.GETTER_METHODS : ExecutableType.NON_GETTER_METHODS);
     }
 
-    private static boolean isGetter(final Method method) {
-        final String name = method.getName();
-        return method.getParameterTypes().length == 0 && !Void.TYPE.equals(method.getReturnType())
-            && (name.startsWith("get") || name.startsWith("is") && boolean.class.equals(method.getReturnType()));
+    private static Iterable<Class<?>> reverseHierarchy(Class<?> t) {
+        final Stream.Builder<Class<?>> builder = Stream.builder();
+        Reflection.hierarchy(t, Interfaces.INCLUDE).forEach(builder);
+        return builder.build()::iterator;
     }
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationConstraintBuilder.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationConstraintBuilder.java b/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationConstraintBuilder.java
deleted file mode 100644
index 4b15ba7..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationConstraintBuilder.java
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.jsr.groups.GroupsComputer;
-import org.apache.bval.jsr.xml.AnnotationProxyBuilder;
-import org.apache.bval.util.AccessStrategy;
-import org.apache.bval.util.reflection.TypeUtils;
-import org.apache.commons.weaver.privilizer.Privileged;
-
-import javax.validation.Constraint;
-import javax.validation.ConstraintDeclarationException;
-import javax.validation.ConstraintDefinitionException;
-import javax.validation.ConstraintTarget;
-import javax.validation.ConstraintValidator;
-import javax.validation.OverridesAttribute;
-import javax.validation.Payload;
-import javax.validation.ReportAsSingleViolation;
-import javax.validation.constraintvalidation.SupportedValidationTarget;
-import javax.validation.constraintvalidation.ValidationTarget;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Description: helper class that builds a {@link ConstraintValidation} or its
- * composite constraint validations by parsing the jsr-annotations and
- * providing information (e.g. for @OverridesAttributes) <br/>
- */
-final class AnnotationConstraintBuilder<A extends Annotation> {
-    private static final Logger log = Logger.getLogger(AnnotationConstraintBuilder.class.getName());
-
-    private final ConstraintValidation<?> constraintValidation;
-    private List<ConstraintOverrides> overrides;
-
-    /**
-     * Create a new AnnotationConstraintBuilder instance.
-     *
-     * @param validatorClasses
-     * @param annotation
-     * @param owner
-     * @param access
-     */
-    public AnnotationConstraintBuilder(Class<? extends ConstraintValidator<A, ?>>[] validatorClasses, A annotation,
-        Class<?> owner, AccessStrategy access, ConstraintTarget target) {
-        final boolean reportFromComposite =
-            annotation != null && annotation.annotationType().isAnnotationPresent(ReportAsSingleViolation.class);
-        constraintValidation =
-            new ConstraintValidation<>(validatorClasses, annotation, owner, access, reportFromComposite, target);
-        buildFromAnnotation();
-    }
-
-    /** build attributes, payload, groups from 'annotation' */
-    @Privileged
-    private void buildFromAnnotation() {
-        if (constraintValidation.getAnnotation() == null) {
-            return;
-        }
-        final Class<? extends Annotation> annotationType = constraintValidation.getAnnotation().annotationType();
-
-        boolean foundPayload = false;
-        boolean foundGroups = false;
-        Method validationAppliesTo = null;
-        boolean foundMessage = false;
-
-        for (final Method method : AnnotationProxyBuilder.findMethods(annotationType)) {
-            // groups + payload must also appear in attributes (also
-            // checked by TCK-Tests)
-            if (method.getParameterTypes().length == 0) {
-                try {
-                    final String name = method.getName();
-                    if (ConstraintAnnotationAttributes.PAYLOAD.getAttributeName().equals(name)) {
-                        buildPayload(method);
-                        foundPayload = true;
-                    } else if (ConstraintAnnotationAttributes.GROUPS.getAttributeName().equals(name)) {
-                        buildGroups(method);
-                        foundGroups = true;
-                    } else if (ConstraintAnnotationAttributes.VALIDATION_APPLIES_TO.getAttributeName().equals(name)) {
-                        buildValidationAppliesTo(method);
-                        validationAppliesTo = method;
-                    } else if (name.startsWith("valid")) {
-                        throw new ConstraintDefinitionException(
-                            "constraints parameters can't start with valid: " + name);
-                    } else {
-                        if (ConstraintAnnotationAttributes.MESSAGE.getAttributeName().equals(name)) {
-                            foundMessage = true;
-                            if (!TypeUtils.isAssignable(method.getReturnType(),
-                                ConstraintAnnotationAttributes.MESSAGE.getType())) {
-                                throw new ConstraintDefinitionException("Return type for message() must be of type "
-                                    + ConstraintAnnotationAttributes.MESSAGE.getType());
-                            }
-                        }
-                        constraintValidation.getAttributes().put(name,
-                            method.invoke(constraintValidation.getAnnotation()));
-                    }
-                } catch (final ConstraintDefinitionException cde) {
-                    throw cde;
-                } catch (final Exception e) { // do nothing
-                    log.log(Level.WARNING,
-                        String.format("Error processing annotation: %s ", constraintValidation.getAnnotation()), e);
-                }
-            }
-        }
-
-        if (!foundMessage) {
-            throw new ConstraintDefinitionException(
-                "Annotation " + annotationType.getName() + " has no message method");
-        }
-        if (!foundPayload) {
-            throw new ConstraintDefinitionException(
-                "Annotation " + annotationType.getName() + " has no payload method");
-        }
-        if (!foundGroups) {
-            throw new ConstraintDefinitionException("Annotation " + annotationType.getName() + " has no groups method");
-        }
-        if (validationAppliesTo != null && ConstraintTarget.IMPLICIT != validationAppliesTo.getDefaultValue()) {
-            throw new ConstraintDefinitionException("validationAppliesTo default value should be IMPLICIT");
-        }
-
-        // valid validationAppliesTo
-        final Constraint annotation = annotationType.getAnnotation(Constraint.class);
-        if (annotation == null) {
-            return;
-        }
-
-        final Pair validationTarget = computeValidationTarget(annotation.validatedBy());
-        for (final Annotation a : annotationType.getAnnotations()) {
-            final Class<? extends Annotation> aClass = a.annotationType();
-            if (aClass.getName().startsWith("java.lang.annotation.")) {
-                continue;
-            }
-
-            final Constraint inheritedConstraint = aClass.getAnnotation(Constraint.class);
-            if (inheritedConstraint != null && !aClass.getName().startsWith("javax.validation.constraints.")) {
-                final Pair validationTargetInherited = computeValidationTarget(inheritedConstraint.validatedBy());
-                if ((validationTarget.a > 0 && validationTargetInherited.b > 0 && validationTarget.b == 0)
-                    || (validationTarget.b > 0 && validationTargetInherited.a > 0 && validationTarget.a == 0)) {
-                    throw new ConstraintDefinitionException("Parent and child constraint have different targets");
-                }
-            }
-        }
-    }
-
-    private Pair computeValidationTarget(final Class<?>[] validators) {
-        int param = 0;
-        int annotatedElt = 0;
-
-        for (final Class<?> validator : validators) {
-            final SupportedValidationTarget supportedAnnotationTypes =
-                validator.getAnnotation(SupportedValidationTarget.class);
-            if (supportedAnnotationTypes != null) {
-                final List<ValidationTarget> values = Arrays.asList(supportedAnnotationTypes.value());
-                if (values.contains(ValidationTarget.PARAMETERS)) {
-                    param++;
-                }
-                if (values.contains(ValidationTarget.ANNOTATED_ELEMENT)) {
-                    annotatedElt++;
-                }
-            } else {
-                annotatedElt++;
-            }
-        }
-
-        if (annotatedElt == 0 && param >= 1 && constraintValidation.getValidationAppliesTo() != null) { // pure cross param
-            throw new ConstraintDefinitionException(
-                "pure cross parameter constraints shouldn't get validationAppliesTo attribute");
-        }
-        if (param >= 1 && annotatedElt >= 1 && constraintValidation.getValidationAppliesTo() == null) { // generic and cross param
-            throw new ConstraintDefinitionException(
-                "cross parameter AND generic constraints should get validationAppliesTo attribute");
-        }
-        if (param == 0 && constraintValidation.getValidationAppliesTo() != null) { // pure generic
-            throw new ConstraintDefinitionException(
-                "pure generic constraints shouldn't get validationAppliesTo attribute");
-        }
-
-        return new Pair(annotatedElt, param);
-    }
-
-    private void buildValidationAppliesTo(final Method method)
-        throws InvocationTargetException, IllegalAccessException {
-        if (!TypeUtils.isAssignable(method.getReturnType(),
-            ConstraintAnnotationAttributes.VALIDATION_APPLIES_TO.getType())) {
-            throw new ConstraintDefinitionException("Return type for validationAppliesTo() must be of type "
-                + ConstraintAnnotationAttributes.VALIDATION_APPLIES_TO.getType());
-        }
-        final Object validationAppliesTo = method.invoke(constraintValidation.getAnnotation());
-        if (!ConstraintTarget.class.isInstance(validationAppliesTo)) {
-            throw new ConstraintDefinitionException("validationAppliesTo type is " + ConstraintTarget.class.getName());
-        }
-        constraintValidation.setValidationAppliesTo(ConstraintTarget.class.cast(validationAppliesTo));
-    }
-
-    private void buildGroups(final Method method) throws IllegalAccessException, InvocationTargetException {
-        if (!TypeUtils.isAssignable(method.getReturnType(), ConstraintAnnotationAttributes.GROUPS.getType())) {
-            throw new ConstraintDefinitionException(
-                "Return type for groups() must be of type " + ConstraintAnnotationAttributes.GROUPS.getType());
-        }
-
-        final Object raw = method.invoke(constraintValidation.getAnnotation());
-        Class<?>[] garr;
-        if (raw instanceof Class<?>) {
-            garr = new Class[] { (Class<?>) raw };
-        } else if (raw instanceof Class<?>[]) {
-            garr = (Class<?>[]) raw;
-            if (Object[].class.cast(method.getDefaultValue()).length > 0) {
-                throw new ConstraintDefinitionException("Default value for groups() must be an empty array");
-            }
-        } else {
-            garr = null;
-        }
-
-        if (garr == null || garr.length == 0) {
-            garr = GroupsComputer.DEFAULT_GROUP;
-        }
-        constraintValidation.setGroups(garr);
-    }
-
-    @SuppressWarnings("unchecked")
-    private void buildPayload(final Method method) throws IllegalAccessException, InvocationTargetException {
-        if (!TypeUtils.isAssignable(method.getReturnType(), ConstraintAnnotationAttributes.PAYLOAD.getType())) {
-            throw new ConstraintDefinitionException(
-                "Return type for payload() must be of type " + ConstraintAnnotationAttributes.PAYLOAD.getType());
-        }
-        if (Object[].class.cast(method.getDefaultValue()).length > 0) {
-            throw new ConstraintDefinitionException("Default value for payload() must be an empty array");
-        }
-
-        final Class<? extends Payload>[] payload_raw =
-            (Class<? extends Payload>[]) method.invoke(constraintValidation.getAnnotation());
-
-        final Set<Class<? extends Payload>> payloadSet;
-        if (payload_raw == null) {
-            payloadSet = Collections.emptySet();
-        } else {
-            payloadSet = new HashSet<>(payload_raw.length);
-            Collections.addAll(payloadSet, payload_raw);
-        }
-        constraintValidation.setPayload(payloadSet);
-    }
-
-    /**
-     * Get the configured {@link ConstraintValidation}.
-     *
-     * @return {@link ConstraintValidation}
-     */
-    public ConstraintValidation<?> getConstraintValidation() {
-        return constraintValidation;
-    }
-
-    /**
-     * initialize a child composite 'validation' with @OverridesAttribute from
-     * 'constraintValidation' and add to composites.
-     */
-    public void addComposed(ConstraintValidation<?> composite) {
-        applyOverridesAttributes(composite);
-
-        if (constraintValidation.getValidationAppliesTo() != null) {
-            composite.setValidationAppliesTo(constraintValidation.getValidationAppliesTo());
-        }
-
-        constraintValidation.addComposed(composite); // add AFTER apply()
-    }
-
-    private void applyOverridesAttributes(ConstraintValidation<?> composite) {
-        if (null == overrides) {
-            buildOverridesAttributes();
-        }
-        if (!overrides.isEmpty()) {
-            final int index = computeIndex(composite);
-
-            // Search for the overrides to apply
-            final ConstraintOverrides generalOverride = findOverride(composite.getAnnotation().annotationType(), -1);
-            if (generalOverride != null) {
-                if (index > 0) {
-                    throw new ConstraintDeclarationException(
-                        "Wrong OverridesAttribute declaration for " + generalOverride.constraintType
-                            + ", it needs a defined index when there is a list of constraints");
-                }
-                generalOverride.applyOn(composite);
-            }
-
-            final ConstraintOverrides override = findOverride(composite.getAnnotation().annotationType(), index);
-            if (override != null) {
-                override.applyOn(composite);
-            }
-        }
-    }
-
-    /**
-     * Calculates the index of the composite constraint. The index represents
-     * the order in which it is added in reference to other constraints of the
-     * same type.
-     *
-     * @param composite
-     *            The composite constraint (not yet added).
-     * @return An integer index always >= 0
-     */
-    private int computeIndex(ConstraintValidation<?> composite) {
-        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<>();
-        for (Method method : constraintValidation.getAnnotation().annotationType().getDeclaredMethods()) {
-            final OverridesAttribute.List overridesAttributeList = method.getAnnotation(OverridesAttribute.List.class);
-            if (overridesAttributeList != null) {
-                for (OverridesAttribute overridesAttribute : overridesAttributeList.value()) {
-                    parseConstraintOverride(method.getName(), overridesAttribute);
-                }
-            }
-            final OverridesAttribute overridesAttribute = method.getAnnotation(OverridesAttribute.class);
-            if (overridesAttribute != null) {
-                parseConstraintOverride(method.getName(), overridesAttribute);
-            }
-        }
-    }
-
-    private void parseConstraintOverride(String methodName, OverridesAttribute oa) {
-        ConstraintOverrides target = findOverride(oa.constraint(), oa.constraintIndex());
-        if (target == null) {
-            target = new ConstraintOverrides(oa.constraint(), oa.constraintIndex());
-            overrides.add(target);
-        }
-        target.values.put(oa.name(), constraintValidation.getAttributes().get(methodName));
-    }
-
-    private ConstraintOverrides findOverride(Class<? extends Annotation> constraint, int constraintIndex) {
-        return overrides.stream()
-            .filter(ov -> ov.constraintType.equals(constraint) && ov.constraintIndex == constraintIndex).findFirst()
-            .orElse(null);
-    }
-
-    /**
-     * Holds the values to override in a composed constraint during creation of
-     * a composed ConstraintValidation
-     */
-    private static final class ConstraintOverrides {
-        final Class<? extends Annotation> constraintType;
-        final int constraintIndex;
-
-        /** key = attributeName, value = overridden value */
-        final Map<String, Object> values;
-
-        private ConstraintOverrides(Class<? extends Annotation> constraintType, int constraintIndex) {
-            this.constraintType = constraintType;
-            this.constraintIndex = constraintIndex;
-            values = new HashMap<>();
-        }
-
-        @SuppressWarnings("unchecked")
-        private void applyOn(ConstraintValidation<?> composite) {
-            // Update the attributes
-            composite.getAttributes().putAll(values);
-
-            // And the annotation
-            final Annotation originalAnnot = composite.getAnnotation();
-            final AnnotationProxyBuilder<Annotation> apb = new AnnotationProxyBuilder<Annotation>(originalAnnot);
-            values.forEach(apb::putValue);
-
-            ((ConstraintValidation<Annotation>) composite).setAnnotation(apb.createAnnotation());
-        }
-    }
-
-    private static class Pair {
-        private int a;
-        private int b;
-
-        private Pair(int a, int b) {
-            this.a = a;
-            this.b = b;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationProcessor.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationProcessor.java b/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationProcessor.java
deleted file mode 100644
index 3c4b046..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationProcessor.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.model.Features;
-import org.apache.bval.model.Meta;
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.util.AccessStrategy;
-import org.apache.bval.util.ObjectUtils;
-import org.apache.bval.util.reflection.Reflection;
-import org.apache.commons.weaver.privilizer.Privilizing;
-import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
-
-import javax.validation.Constraint;
-import javax.validation.ConstraintValidator;
-import javax.validation.Valid;
-import javax.validation.constraintvalidation.SupportedValidationTarget;
-import javax.validation.constraintvalidation.ValidationTarget;
-import javax.validation.groups.ConvertGroup;
-import javax.validation.groups.Default;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Description: implements uniform handling of JSR303 {@link Constraint}
- * annotations, including composed constraints and the resolution of
- * {@link ConstraintValidator} implementations.
- */
-@Privilizing(@CallTo(Reflection.class))
-public final class AnnotationProcessor {
-    /** {@link ApacheFactoryContext} used */
-    private final ApacheValidatorFactory factory;
-
-    /**
-     * Create a new {@link AnnotationProcessor} instance.
-     * 
-     * @param factory the validator factory.
-     */
-    public AnnotationProcessor(ApacheValidatorFactory factory) {
-        this.factory = factory;
-    }
-
-    /**
-     * Process JSR303 annotations.
-     * 
-     * @param prop
-     *            potentially null
-     * @param owner
-     *            bean type
-     * @param element
-     *            whose annotations to read
-     * @param access
-     *            strategy for <code>prop</code>
-     * @param appender
-     *            handling accumulation
-     * @return whether any processing took place
-     * @throws IllegalAccessException
-     * @throws InvocationTargetException
-     */
-    public boolean processAnnotations(Meta prop, Class<?> owner, AnnotatedElement element, AccessStrategy access,
-        AppendValidation appender) throws IllegalAccessException, InvocationTargetException {
-
-        boolean changed = false;
-        for (final Annotation annotation : element.getDeclaredAnnotations()) {
-            final Class<?> type = annotation.annotationType();
-            if (type.getName().startsWith("java.lang.annotation.")) {
-                continue;
-            }
-            changed = processAnnotation(annotation, prop, owner, access, appender, true) || changed;
-        }
-        return changed;
-    }
-
-    /**
-     * Process a single annotation.
-     * 
-     * @param <A>
-     *            annotation type
-     * @param annotation
-     *            to process
-     * @param prop
-     *            potentially null
-     * @param owner
-     *            bean type
-     * @param access
-     *            strategy for <code>prop</code>
-     * @param appender
-     *            handling accumulation
-     * @return whether any processing took place
-     * @throws IllegalAccessException
-     * @throws InvocationTargetException
-     */
-    public <A extends Annotation> boolean processAnnotation(A annotation, Meta prop, Class<?> owner,
-        AccessStrategy access, AppendValidation appender, boolean reflection)
-        throws IllegalAccessException, InvocationTargetException {
-        if (annotation instanceof Valid) {
-            return addAccessStrategy(prop, access);
-        }
-
-        if (ConvertGroup.class.isInstance(annotation) || ConvertGroup.List.class.isInstance(annotation)) {
-            if (!reflection) {
-                Collection<Annotation> annotations = prop.getFeature(JsrFeatures.Property.ANNOTATIONS_TO_PROCESS);
-                if (annotations == null) {
-                    annotations = new ArrayList<>();
-                    prop.putFeature(JsrFeatures.Property.ANNOTATIONS_TO_PROCESS, annotations);
-                }
-                annotations.add(annotation);
-            }
-            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 =
-                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
-         * array of constraint annotations in a special way.
-         */
-        final Object result =
-            Reflection.getAnnotationValue(annotation, ConstraintAnnotationAttributes.VALUE.getAttributeName());
-        if (result instanceof Annotation[]) {
-            boolean changed = false;
-            for (final Annotation each : (Annotation[]) result) {
-                if (each.annotationType().getName().startsWith("java.lang.annotation")) {
-                    continue;
-                }
-
-                changed |= processAnnotation(each, prop, owner, access, appender, reflection);
-            }
-            return changed;
-        }
-        return false;
-    }
-
-    /**
-     * Add the specified {@link AccessStrategy} to <code>prop</code>; noop if
-     * <code>prop == null</code>.
-     * 
-     * @param prop
-     * @param access
-     * @return whether anything took place.
-     */
-    public boolean addAccessStrategy(Meta prop, AccessStrategy access) {
-        if (prop == null) {
-            return false;
-        }
-        AccessStrategy[] strategies = prop.getFeature(Features.Property.REF_CASCADE);
-        if (ObjectUtils.arrayContains(strategies, access)) {
-            return false;
-        }
-        if (strategies == null) {
-            strategies = new AccessStrategy[] { access };
-        } else {
-            strategies = ObjectUtils.arrayAdd(strategies, access);
-        }
-        prop.putFeature(Features.Property.REF_CASCADE, strategies);
-        return true;
-    }
-
-    /**
-     * Find available {@link ConstraintValidation} classes for a given
-     * constraint annotation.
-     * 
-     * @param annotation
-     * @param vcAnno
-     * @return {@link ConstraintValidation} implementation class array
-     */
-    @SuppressWarnings("unchecked")
-    private <A extends Annotation> Class<? extends ConstraintValidator<A, ?>>[] findConstraintValidatorClasses(
-        A annotation, Constraint vcAnno) {
-        if (vcAnno == null) {
-            vcAnno = annotation.annotationType().getAnnotation(Constraint.class);
-        }
-        final Class<A> annotationType = (Class<A>) annotation.annotationType();
-        List<Class<? extends ConstraintValidator<A, ?>>> validatorClasses =
-            factory.getConstraintsCache().getConstraintValidatorClasses(annotationType);
-        if (validatorClasses == null) {
-            validatorClasses = Arrays.asList((Class<? extends ConstraintValidator<A, ?>>[]) vcAnno.validatedBy());
-            if (validatorClasses.isEmpty()) {
-            }
-        }
-        return validatorClasses.toArray(new Class[validatorClasses.size()]);
-    }
-
-    /**
-     * Apply a constraint to the specified <code>appender</code>.
-     * 
-     * @param annotation
-     *            constraint annotation
-     * @param rawConstraintClasses
-     *            known {@link ConstraintValidator} implementation classes for
-     *            <code>annotation</code>
-     * @param prop
-     *            meta-property
-     * @param owner
-     *            type
-     * @param access
-     *            strategy
-     * @param appender
-     * @return success flag
-     * @throws IllegalAccessException
-     * @throws InvocationTargetException
-     */
-    private <A extends Annotation> boolean applyConstraint(A annotation,
-        Class<? extends ConstraintValidator<A, ?>>[] rawConstraintClasses, Meta prop, Class<?> owner,
-        AccessStrategy access, AppendValidation appender) throws IllegalAccessException, InvocationTargetException {
-
-        final Class<? extends ConstraintValidator<A, ?>>[] constraintClasses = select(rawConstraintClasses, access);
-        if (constraintClasses != null && constraintClasses.length == 0 && rawConstraintClasses.length > 0) {
-            return false;
-        }
-
-        final AnnotationConstraintBuilder<A> builder =
-            new AnnotationConstraintBuilder<A>(constraintClasses, annotation, owner, access, null);
-
-        // JSR-303 3.4.4: Add implicit groups
-        if (prop != null && prop.getParentMetaBean() != null) {
-            final MetaBean parentMetaBean = prop.getParentMetaBean();
-            // If:
-            // - the owner is an interface
-            // - the class of the metabean being build is different than the
-            // owner
-            // - and only the Default group is defined
-            // Then: add the owner interface as implicit groups
-            if (builder.getConstraintValidation().getOwner().isInterface()
-                && parentMetaBean.getBeanClass() != builder.getConstraintValidation().getOwner()
-                && builder.getConstraintValidation().getGroups().size() == 1
-                && builder.getConstraintValidation().getGroups().contains(Default.class)) {
-                Set<Class<?>> groups = builder.getConstraintValidation().getGroups();
-                groups.add(builder.getConstraintValidation().getOwner());
-                builder.getConstraintValidation().setGroups(groups);
-            }
-        }
-
-        // If already building a constraint composition tree, ensure that:
-        // - the parent groups are inherited
-        // - the parent payload is inherited
-        if (appender instanceof AppendValidationToBuilder) {
-            AppendValidationToBuilder avb = (AppendValidationToBuilder) appender;
-            builder.getConstraintValidation().setGroups(avb.getInheritedGroups());
-            builder.getConstraintValidation().setPayload(avb.getInheritedPayload());
-        }
-
-        // process composed constraints:
-        // here are not other superclasses possible, because annotations do not
-        // inherit!
-        processAnnotations(prop, owner, annotation.annotationType(), access, new AppendValidationToBuilder(builder));
-
-        // Even if the validator is null, it must be added to mimic the RI impl
-        appender.append(builder.getConstraintValidation());
-        return true;
-    }
-
-    private static <A extends Annotation> Class<? extends ConstraintValidator<A, ?>>[] select(
-        final Class<? extends ConstraintValidator<A, ?>>[] rawConstraintClasses, final AccessStrategy access) {
-        final boolean isReturn = ReturnAccess.class.isInstance(access);
-        final boolean isParam = ParametersAccess.class.isInstance(access);
-        if (rawConstraintClasses != null && (isReturn || isParam)) {
-            final Collection<Class<? extends ConstraintValidator<A, ?>>> selected =
-                new ArrayList<Class<? extends ConstraintValidator<A, ?>>>();
-            for (final Class<? extends ConstraintValidator<A, ?>> constraint : rawConstraintClasses) {
-                final SupportedValidationTarget target = constraint.getAnnotation(SupportedValidationTarget.class);
-                if (target == null && isReturn) {
-                    selected.add(constraint);
-                } else if (target != null) {
-                    for (final ValidationTarget validationTarget : target.value()) {
-                        if (isReturn && ValidationTarget.ANNOTATED_ELEMENT == validationTarget) {
-                            selected.add(constraint);
-                        } else if (isParam && ValidationTarget.PARAMETERS == validationTarget) {
-                            selected.add(constraint);
-                        }
-                    }
-                }
-            }
-            @SuppressWarnings("unchecked")
-            final Class<? extends ConstraintValidator<A, ?>>[] result = selected.toArray(new Class[selected.size()]);
-            return result;
-        }
-        return rawConstraintClasses;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java
index 1e4b263..2feab79 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java
@@ -27,7 +27,6 @@ import javax.validation.Validator;
 import javax.validation.ValidatorContext;
 import javax.validation.valueextraction.ValueExtractor;
 
-import org.apache.bval.MetaBeanFinder;
 import org.apache.bval.jsr.descriptor.DescriptorManager;
 import org.apache.bval.jsr.groups.GroupsComputer;
 import org.apache.bval.jsr.valueextraction.ValueExtractors;
@@ -44,7 +43,6 @@ public class ApacheFactoryContext implements ValidatorContext {
     private final Lazy<GroupsComputer> groupsComputer = new Lazy<>(GroupsComputer::new);
     private final ApacheValidatorFactory factory;
     private final ValueExtractors valueExtractors;
-    private volatile MetaBeanFinder metaBeanFinder;
 
     private MessageInterpolator messageInterpolator;
     private TraversableResolver traversableResolver;
@@ -60,9 +58,8 @@ public class ApacheFactoryContext implements ValidatorContext {
      * @param metaBeanFinder
      *            meta finder
      */
-    public ApacheFactoryContext(ApacheValidatorFactory factory, MetaBeanFinder metaBeanFinder) {
+    public ApacheFactoryContext(ApacheValidatorFactory factory) {
         this.factory = factory;
-        this.metaBeanFinder = metaBeanFinder;
         valueExtractors = factory.getValueExtractors().createChild();
     }
 
@@ -76,15 +73,6 @@ public class ApacheFactoryContext implements ValidatorContext {
     }
 
     /**
-     * Get the metaBeanFinder.
-     * 
-     * @return {@link MetaBeanFinder}
-     */
-    public final MetaBeanFinder getMetaBeanFinder() {
-        return metaBeanFinder;
-    }
-
-    /**
      * Discard cached metadata. Calling this method unnecessarily has the effect of severly limiting performance,
      * therefore only do so when changes have been made that affect validation metadata, i.e. particularly NOT in
      * response to:
@@ -95,7 +83,7 @@ public class ApacheFactoryContext implements ValidatorContext {
      * </ul>
      */
     private synchronized void resetMeta() {
-        metaBeanFinder = factory.buildMetaBeanFinder();
+        getDescriptorManager().clear();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorFactory.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorFactory.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorFactory.java
index 3bff1c5..91b2e86 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorFactory.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorFactory.java
@@ -19,17 +19,11 @@
 package org.apache.bval.jsr;
 
 import java.io.Closeable;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
 import java.lang.reflect.Modifier;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
 
 import javax.validation.ClockProvider;
 import javax.validation.ConstraintValidatorFactory;
@@ -42,26 +36,12 @@ import javax.validation.Validator;
 import javax.validation.ValidatorFactory;
 import javax.validation.spi.ConfigurationState;
 
-import org.apache.bval.IntrospectorMetaBeanFactory;
-import org.apache.bval.MetaBeanBuilder;
-import org.apache.bval.MetaBeanFactory;
-import org.apache.bval.MetaBeanFinder;
-import org.apache.bval.MetaBeanManager;
 import org.apache.bval.jsr.descriptor.DescriptorManager;
 import org.apache.bval.jsr.metadata.MetadataBuilders;
 import org.apache.bval.jsr.util.AnnotationsManager;
 import org.apache.bval.jsr.valueextraction.ValueExtractors;
-import org.apache.bval.jsr.xml.AnnotationIgnores;
-import org.apache.bval.jsr.xml.MetaConstraint;
 import org.apache.bval.jsr.xml.ValidationMappingParser;
-import org.apache.bval.util.AccessStrategy;
-import org.apache.bval.util.ObjectUtils;
-import org.apache.bval.util.StringUtils;
 import org.apache.bval.util.reflection.Reflection;
-import org.apache.bval.xml.XMLMetaBeanBuilder;
-import org.apache.bval.xml.XMLMetaBeanFactory;
-import org.apache.bval.xml.XMLMetaBeanManager;
-import org.apache.commons.weaver.privilizer.Privileged;
 import org.apache.commons.weaver.privilizer.Privilizing;
 import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
 
@@ -85,72 +65,8 @@ public class ApacheValidatorFactory implements ValidatorFactory, Cloneable {
     private final DescriptorManager descriptorManager = new DescriptorManager(this);
     private final MetadataBuilders metadataBuilders = new MetadataBuilders();
     private final ValueExtractors valueExtractors = new ValueExtractors();
-
-    /**
-     * information from xml parsing
-     */
-    private final AnnotationIgnores annotationIgnores = new AnnotationIgnores();
     private final ConstraintCached constraintsCache = new ConstraintCached();
-    private final Map<Class<?>, Class<?>[]> defaultSequences;
-
-    /**
-     * access strategies for properties with cascade validation @Valid support
-     */
-    private final ConcurrentMap<Class<?>, List<AccessStrategy>> validAccesses;
-    private final ConcurrentMap<Class<?>, List<MetaConstraint<?, ? extends Annotation>>> constraintMap;
-
     private final Collection<Closeable> toClose = new ArrayList<>();
-    private final MetaBeanFinder defaultMetaBeanFinder;
-
-    /**
-     * Create MetaBeanManager that uses factories:
-     * <ol>
-     * <li>if enabled by
-     * {@link ApacheValidatorConfiguration.Properties#ENABLE_INTROSPECTOR}, an
-     * {@link IntrospectorMetaBeanFactory}</li>
-     * <li>{@link MetaBeanFactory} types (if any) specified by
-     * {@link ApacheValidatorConfiguration.Properties#METABEAN_FACTORY_CLASSNAMES}
-     * </li>
-     * <li>if no {@link JsrMetaBeanFactory} has yet been specified (this
-     * allows factory order customization), a {@link JsrMetaBeanFactory}
-     * which handles both JSR303-XML and JSR303-Annotations</li>
-     * <li>if enabled by
-     * {@link ApacheValidatorConfiguration.Properties#ENABLE_METABEANS_XML}, an
-     * {@link XMLMetaBeanFactory}</li>
-     * </ol>
-     *
-     * @return a new instance of MetaBeanManager with adequate MetaBeanFactories
-     */
-    protected MetaBeanFinder buildMetaBeanFinder() {
-        final List<MetaBeanFactory> builders = new ArrayList<>();
-        if (Boolean.parseBoolean(getProperties().get(ApacheValidatorConfiguration.Properties.ENABLE_INTROSPECTOR))) {
-            builders.add(new IntrospectorMetaBeanFactory());
-        }
-        final String[] factoryClassNames =
-            StringUtils.split(getProperties().get(ApacheValidatorConfiguration.Properties.METABEAN_FACTORY_CLASSNAMES));
-        if (factoryClassNames != null) {
-            for (String clsName : factoryClassNames) {
-                // cast, relying on #createMetaBeanFactory to throw the exception if incompatible:
-                final Class<? extends MetaBeanFactory> factoryClass =
-                    loadClass(clsName).asSubclass(MetaBeanFactory.class);
-                builders.add(createMetaBeanFactory(factoryClass));
-            }
-        }
-        boolean jsrFound = false;
-        for (MetaBeanFactory builder : builders) {
-            jsrFound |= builder instanceof JsrMetaBeanFactory;
-        }
-        if (!jsrFound) {
-            builders.add(new JsrMetaBeanFactory(this));
-        }
-        @SuppressWarnings("deprecation")
-        final boolean enableMetaBeansXml =
-            Boolean.parseBoolean(getProperties().get(ApacheValidatorConfiguration.Properties.ENABLE_METABEANS_XML));
-        if (enableMetaBeansXml) {
-            XMLMetaBeanManagerCreator.addFactory(builders);
-        }
-        return createMetaBeanManager(builders);
-    }
 
     /**
      * Convenience method to retrieve a default global ApacheValidatorFactory
@@ -183,10 +99,6 @@ public class ApacheValidatorFactory implements ValidatorFactory, Cloneable {
      */
     public ApacheValidatorFactory(ConfigurationState configuration) {
         properties = new HashMap<>(configuration.getProperties());
-        defaultSequences = new HashMap<>();
-        validAccesses = new ConcurrentHashMap<>();
-        constraintMap = new ConcurrentHashMap<>();
-
         parameterNameProvider = configuration.getParameterNameProvider();
         messageResolver = configuration.getMessageInterpolator();
         traversableResolver = configuration.getTraversableResolver();
@@ -197,10 +109,9 @@ public class ApacheValidatorFactory implements ValidatorFactory, Cloneable {
             toClose.add(ConfigurationImpl.class.cast(configuration).getClosable());
         }
 
+        //TODO introduce service interface
         new ValidationMappingParser(this).processMappingConfig(configuration.getMappingStreams());
 
-        defaultMetaBeanFinder = buildMetaBeanFinder();
-
         configuration.getValueExtractors().forEach(valueExtractors::add);
         annotationsManager = new AnnotationsManager(this);
     }
@@ -231,7 +142,7 @@ public class ApacheValidatorFactory implements ValidatorFactory, Cloneable {
      */
     @Override
     public ApacheFactoryContext usingContext() {
-        return new ApacheFactoryContext(this, defaultMetaBeanFinder);
+        return new ApacheFactoryContext(this);
     }
 
     /**
@@ -388,15 +299,6 @@ public class ApacheValidatorFactory implements ValidatorFactory, Cloneable {
     }
 
     /**
-     * Get the detected {@link AnnotationIgnores}.
-     *
-     * @return AnnotationIgnores
-     */
-    public AnnotationIgnores getAnnotationIgnores() {
-        return annotationIgnores;
-    }
-
-    /**
      * Get the constraint cache used.
      *
      * @return {@link ConstraintCached}
@@ -432,165 +334,7 @@ public class ApacheValidatorFactory implements ValidatorFactory, Cloneable {
         return valueExtractors;
     }
 
-    /**
-     * Add a meta-constraint to this {@link ApacheValidatorFactory}'s runtime customizations.
-     *
-     * @param beanClass
-     * @param metaConstraint
-     */
-    public void addMetaConstraint(final Class<?> beanClass, final MetaConstraint<?, ?> metaConstraint) {
-        List<MetaConstraint<?, ? extends Annotation>> slot = constraintMap.get(beanClass);
-        if (slot == null) {
-            slot = new ArrayList<>();
-            final List<MetaConstraint<?, ? extends Annotation>> old = constraintMap.putIfAbsent(beanClass, slot);
-            if (old != null) {
-                slot = old;
-            }
-        }
-        slot.add(metaConstraint);
-    }
-
-    /**
-     * Mark a property of <code>beanClass</code> for nested validation.
-     *
-     * @param beanClass
-     * @param accessStrategy
-     *            defining the property to validate
-     */
-    public void addValid(Class<?> beanClass, AccessStrategy accessStrategy) {
-        List<AccessStrategy> slot = validAccesses.get(beanClass);
-        if (slot == null) {
-            slot = new ArrayList<>();
-            final List<AccessStrategy> old = validAccesses.putIfAbsent(beanClass, slot);
-            if (old != null) {
-                slot = old;
-            }
-        }
-        slot.add(accessStrategy);
-    }
-
-    /**
-     * Set the default group sequence for a particular bean class.
-     *
-     * @param beanClass
-     * @param groupSequence
-     */
-    public void addDefaultSequence(Class<?> beanClass, Class<?>... groupSequence) {
-        defaultSequences.put(beanClass, safeArray(groupSequence));
-    }
-
-    /**
-     * Retrieve the runtime constraint configuration for a given class.
-     *
-     * @param <T>
-     * @param beanClass
-     * @return List of {@link MetaConstraint}s applicable to <code>beanClass</code>
-     */
-    public <T> List<MetaConstraint<T, ? extends Annotation>> getMetaConstraints(Class<T> beanClass) {
-        final List<MetaConstraint<?, ? extends Annotation>> slot = constraintMap.get(beanClass);
-        if (slot == null) {
-            return Collections.emptyList();
-        }
-        // noinspection RedundantCast
-        @SuppressWarnings({ "unchecked", "rawtypes" })
-        final List<MetaConstraint<T, ? extends Annotation>> result = (List) slot;
-        return Collections.unmodifiableList(result);
-    }
-
-    /**
-     * Get the {@link AccessStrategy} {@link List} indicating nested bean validations that must be triggered in the
-     * course of validating a <code>beanClass</code> graph.
-     *
-     * @param beanClass
-     * @return {@link List} of {@link AccessStrategy}
-     */
-    public List<AccessStrategy> getValidAccesses(Class<?> beanClass) {
-        final List<AccessStrategy> slot = validAccesses.get(beanClass);
-        return slot == null ? Collections.emptyList() : Collections.unmodifiableList(slot);
-    }
-
-    /**
-     * Get the default group sequence configured for <code>beanClass</code>.
-     *
-     * @param beanClass
-     * @return group Class array
-     */
-    public Class<?>[] getDefaultSequence(Class<?> beanClass) {
-        return safeArray(defaultSequences.get(beanClass));
-    }
-
     public MetadataBuilders getMetadataBuilders() {
         return metadataBuilders;
     }
-
-    private static Class<?>[] safeArray(Class<?>... array) {
-        return array == null || array.length == 0 ? ObjectUtils.EMPTY_CLASS_ARRAY : array.clone();
-    }
-
-    /**
-     * Create a {@link MetaBeanManager} using the specified builders.
-     *
-     * @param builders
-     *            {@link MetaBeanFactory} {@link List}
-     * @return {@link MetaBeanManager}
-     */
-    @SuppressWarnings("deprecation")
-    protected MetaBeanFinder createMetaBeanManager(List<MetaBeanFactory> builders) {
-        // as long as we support both: jsr (in the builders list) and xstream-xml metabeans:
-        if (Boolean.parseBoolean(getProperties().get(ApacheValidatorConfiguration.Properties.ENABLE_METABEANS_XML))) {
-            return XMLMetaBeanManagerCreator.createXMLMetaBeanManager(builders);
-        }
-        return new MetaBeanManager(new MetaBeanBuilder(builders.toArray(new MetaBeanFactory[builders.size()])));
-    }
-
-    @Privileged
-    private <F extends MetaBeanFactory> F createMetaBeanFactory(final Class<F> cls) {
-        try {
-            Constructor<F> c = Reflection.getDeclaredConstructor(cls, ApacheValidatorFactory.this.getClass());
-            if (c != null) {
-                return c.newInstance(this);
-            }
-            c = Reflection.getDeclaredConstructor(cls, getClass());
-            if (c != null) {
-                return c.newInstance(this);
-            }
-            return cls.getConstructor().newInstance();
-        } catch (Exception e) {
-            throw new ValidationException(e);
-        }
-    }
-
-    /**
-     * separate class to prevent the classloader to immediately load optional classes: XMLMetaBeanManager,
-     * XMLMetaBeanFactory, XMLMetaBeanBuilder that might not be available in the classpath
-     */
-    private static class XMLMetaBeanManagerCreator {
-
-        static void addFactory(List<MetaBeanFactory> builders) {
-            builders.add(new XMLMetaBeanFactory());
-        }
-
-        /**
-         * Create the {@link MetaBeanManager} to process JSR303 XML. Requires bval-xstream at RT.
-         *
-         * @param builders
-         *            meta bean builders
-         * @return {@link MetaBeanManager}
-         */
-        // NOTE - We return MetaBeanManager instead of XMLMetaBeanManager to
-        // keep
-        // bval-xstream an optional module.
-        protected static MetaBeanManager createXMLMetaBeanManager(List<MetaBeanFactory> builders) {
-            return new XMLMetaBeanManager(
-                new XMLMetaBeanBuilder(builders.toArray(new MetaBeanFactory[builders.size()])));
-        }
-    }
-
-    private Class<?> loadClass(final String className) {
-        try {
-            return Class.forName(className, true, Reflection.getClassLoader(ApacheValidatorFactory.class));
-        } catch (ClassNotFoundException ex) {
-            throw new ValidationException("Unable to load class: " + className, ex);
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidation.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidation.java b/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidation.java
deleted file mode 100644
index 70d3df5..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.bval.jsr;
-
-import java.lang.annotation.Annotation;
-
-/**
- * Description: unified interface to accumulate {@link ConstraintValidation}s
- * to varied targets.<br/>
- */
-public interface AppendValidation {
-    /**
-     * Append a {@link ConstraintValidation}.
-     * @param <T>
-     * @param validation
-     */
-    <T extends Annotation> void append(ConstraintValidation<T> validation);
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToBuilder.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToBuilder.java b/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToBuilder.java
deleted file mode 100644
index 6d3f060..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToBuilder.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.jsr.xml.AnnotationProxyBuilder;
-
-import javax.validation.Payload;
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-/**
- * Description: Adapt {@link AnnotationConstraintBuilder} to the {@link AppendValidation} interface.<br/>
- */
-public class AppendValidationToBuilder extends BaseAppendValidation {
-    private final AnnotationConstraintBuilder<?> builder;
-
-    /**
-     * Create a new AppendValidationToBuilder instance.
-     * @param builder
-     */
-    public AppendValidationToBuilder(AnnotationConstraintBuilder<?> builder) {
-        this.builder = builder;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <T extends Annotation> void preProcessValidation(ConstraintValidation<T> validation) {
-        // JSR-303 2.3:
-        // Groups from the main constraint annotation are inherited by the composing annotations.
-        // Any groups definition on a composing annotation is ignored.
-        final Set<Class<?>> inheritedGroups = builder.getConstraintValidation().getGroups();
-        validation.setGroups(inheritedGroups);
-
-        // JSR-303 2.3 p:
-        // Payloads are also inherited
-        final Set<Class<? extends Payload>> inheritedPayload = builder.getConstraintValidation().getPayload();
-        validation.setPayload(inheritedPayload);
-
-        // 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);
-        apb.putValue(ConstraintAnnotationAttributes.GROUPS.getAttributeName(),
-            inheritedGroups.toArray(new Class[inheritedGroups.size()]));
-        apb.putValue(ConstraintAnnotationAttributes.PAYLOAD.getAttributeName(),
-            inheritedPayload.toArray(new Class[inheritedPayload.size()]));
-        final T newAnnot = apb.createAnnotation();
-        validation.setAnnotation(newAnnot);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <T extends Annotation> void performAppend(ConstraintValidation<T> validation) {
-        builder.addComposed(validation);
-    }
-
-    /**
-     * Get inherited groups.
-     * @return The set of groups from the parent constraint.
-     */
-    public Set<Class<?>> getInheritedGroups() {
-        return builder.getConstraintValidation().getGroups();
-    }
-
-    /**
-     * Get inherited payload.
-     * @return The set of payloads from the parent constraint.
-     */
-    public Set<Class<? extends Payload>> getInheritedPayload() {
-        return builder.getConstraintValidation().getPayload();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToList.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToList.java b/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToList.java
deleted file mode 100644
index 00a05b2..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToList.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.bval.jsr;
-
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Description: {@link org.apache.bval.jsr.AppendValidation} implementation that acts as an intermediate
- * cache of validations for further processing.<br/>
- */
-public class AppendValidationToList extends BaseAppendValidation {
-    private final List<ConstraintValidation<?>> validations = new ArrayList<ConstraintValidation<?>>();
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <T extends Annotation> void performAppend(ConstraintValidation<T> validation) {
-        validations.add(validation);
-    }
-
-    /**
-     * Get the list of cached validations.
-     * @return {@link java.util.List} of {@link org.apache.bval.jsr.ConstraintValidation}
-     */
-    public List<ConstraintValidation<?>> getValidations() {
-        return validations;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToMeta.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToMeta.java b/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToMeta.java
deleted file mode 100644
index f9716e2..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToMeta.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.model.FeaturesCapable;
-
-import java.lang.annotation.Annotation;
-
-/**
- * Description: adapt any {@link FeaturesCapable} from the core meta-model to the {@link AppendValidation} interface.<br/>
- */
-public class AppendValidationToMeta extends BaseAppendValidation {
-    private final FeaturesCapable feature;
-
-    /**
-     * Create a new AppendValidationToMeta instance.
-     * @param meta
-     */
-    public AppendValidationToMeta(FeaturesCapable meta) {
-        this.feature = meta;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <T extends Annotation> void performAppend(ConstraintValidation<T> validation) {
-        feature.addValidation(validation);
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/BaseAppendValidation.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/BaseAppendValidation.java b/bval-jsr/src/main/java/org/apache/bval/jsr/BaseAppendValidation.java
deleted file mode 100644
index d7182ac..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/BaseAppendValidation.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.    
- */
-package org.apache.bval.jsr;
-
-import java.lang.annotation.Annotation;
-
-/**
- * Abstract base validation appender that initializes the
- * {@link ConstraintValidation#getValidator()} on post-processing.
- * 
- * @author Carlos Vara
- */
-public abstract class BaseAppendValidation implements AppendValidation {
-
-    /**
-     * {@inheritDoc}
-     *
-     * Append operation divided in 3 stages: pre & post processing and the
-     * "real" append process.
-     */
-    @Override
-    public final <T extends Annotation> void append(final ConstraintValidation<T> validation) {
-        preProcessValidation(validation);
-        performAppend(validation);
-        postProcessValidation(validation);
-    }
-
-    /**
-     * Performs the actual "appending" operation to the underlying data
-     * structure that holds the validations. Implementations shouldn't try to do
-     * more than that in this step.
-     * 
-     * @param <T>
-     *            The type of the validation.
-     * @param validation
-     *            The validation to be appended.
-     */
-    public abstract <T extends Annotation> void performAppend(final ConstraintValidation<T> validation);
-
-    /**
-     * Pre-process the validation before appending it.
-     * 
-     * @param <T>
-     *            The type of the validation.
-     * @param validation
-     *            The validation to be appended.
-     */
-    public <T extends Annotation> void preProcessValidation(final ConstraintValidation<T> validation) {
-        // No generic pre-processing
-    }
-
-    /**
-     * Post-process the validation once it postProcessValidationhas been appended.
-     * 
-     * @param <T>
-     *            The type of the validation.
-     * @param validation
-     *            The validation to be appended.
-     */
-    public <T extends Annotation> void postProcessValidation(final ConstraintValidation<T> validation) {
-    }
-
-}


[3/6] bval git commit: clean up no-longer-used code from JSR module

Posted by mb...@apache.org.
http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidation.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidation.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidation.java
deleted file mode 100644
index 5ba14ca..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidation.java
+++ /dev/null
@@ -1,605 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.jsr.util.NodeImpl;
-import org.apache.bval.jsr.util.PathImpl;
-import org.apache.bval.model.Validation;
-import org.apache.bval.model.ValidationContext;
-import org.apache.bval.model.ValidationListener;
-import org.apache.bval.util.AccessStrategy;
-import org.apache.bval.util.ObjectUtils;
-import org.apache.bval.util.StringUtils;
-import org.apache.bval.util.reflection.Reflection;
-import org.apache.bval.util.reflection.TypeUtils;
-
-import javax.validation.ConstraintDefinitionException;
-import javax.validation.ConstraintTarget;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorFactory;
-import javax.validation.Payload;
-import javax.validation.UnexpectedTypeException;
-import javax.validation.ValidationException;
-import javax.validation.constraintvalidation.SupportedValidationTarget;
-import javax.validation.constraintvalidation.ValidationTarget;
-import javax.validation.metadata.ConstraintDescriptor;
-import javax.validation.metadata.ValidateUnwrappedValue;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Array;
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * Description: Adapter between Constraint (JSR303) and Validation (Core)<br/>
- * this instance is immutable!<br/>
- */
-public class ConstraintValidation<T extends Annotation> implements Validation, ConstraintDescriptor<T> {
-    private final AccessStrategy access;
-    private final boolean reportFromComposite;
-    private final Map<String, Object> attributes;
-    private T annotation; // for metadata request API
-    private volatile ConstraintValidator<T, ?> validator;
-
-    private Set<ConstraintValidation<?>> composedConstraints;
-
-    private boolean validated = false;
-
-    /**
-     * the owner is the type where the validation comes from. it is used to
-     * support implicit grouping.
-     */
-    private final Class<?> owner;
-    private Set<Class<?>> groups;
-    private Set<Class<? extends Payload>> payload;
-    private Class<? extends ConstraintValidator<T, ?>>[] validatorClasses;
-    private ConstraintTarget validationAppliesTo = null;
-
-    public ConstraintValidation(Class<? extends ConstraintValidator<T, ?>>[] validatorClasses, T annotation,
-        Class<?> owner, AccessStrategy access, boolean reportFromComposite, ConstraintTarget target) {
-        this.attributes = new HashMap<String, Object>();
-        this.validatorClasses = validatorClasses != null ? validatorClasses.clone() : null;
-        this.annotation = annotation;
-        this.owner = owner;
-        this.access = access;
-        this.reportFromComposite = reportFromComposite;
-        this.validationAppliesTo = target;
-    }
-
-    /**
-     * Return a {@link Serializable} {@link ConstraintDescriptor} capturing a
-     * snapshot of current state.
-     *
-     * @return {@link ConstraintDescriptor}
-     */
-    public ConstraintDescriptor<T> asSerializableDescriptor() {
-        return new ConstraintDescriptorImpl<T>(this);
-    }
-
-    void setGroups(final Set<Class<?>> groups) {
-        this.groups = groups;
-        ConstraintAnnotationAttributes.GROUPS.put(attributes, groups.toArray(new Class<?>[groups.size()]));
-    }
-
-    void setGroups(final Class<?>[] groups) {
-        this.groups = new HashSet<Class<?>>();
-        Collections.addAll(this.groups, groups);
-        ConstraintAnnotationAttributes.GROUPS.put(attributes, groups);
-    }
-
-    void setPayload(Set<Class<? extends Payload>> payload) {
-        this.payload = payload;
-        ConstraintAnnotationAttributes.PAYLOAD.put(attributes, payload.toArray(new Class[payload.size()]));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean isReportAsSingleViolation() {
-        return reportFromComposite;
-    }
-
-    /**
-     * Add a composing constraint.
-     *
-     * @param aConstraintValidation to add
-     */
-    public void addComposed(ConstraintValidation<?> aConstraintValidation) {
-        if (composedConstraints == null) {
-            composedConstraints = new HashSet<ConstraintValidation<?>>();
-        }
-        composedConstraints.add(aConstraintValidation);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <L extends ValidationListener> void validate(ValidationContext<L> context) {
-        validateGroupContext((GroupValidationContext<?>) context);
-    }
-
-    /**
-     * Validate a {@link GroupValidationContext}.
-     *
-     * @param context root
-     */
-    public void validateGroupContext(final GroupValidationContext<?> context) {
-        if (validator == null) {
-            synchronized (this) {
-                if (validator == null) {
-                    try {
-                        validator = getConstraintValidator(context.getConstraintValidatorFactory(), annotation,
-                            validatorClasses, owner, access);
-                        if (validator != null) {
-                            validator.initialize(annotation);
-                        }
-                    } catch (final RuntimeException re) {
-                        if (ValidationException.class.isInstance(re)) {
-                            throw re;
-                        }
-                        throw new ConstraintDefinitionException(re);
-                    }
-                }
-            }
-        }
-
-        context.setConstraintValidation(this);
-        /**
-         * execute unless the given validation constraint has already been
-         * processed during this validation routine (as part of a previous group
-         * match)
-         */
-        if (!isMemberOf(context.getCurrentGroup().getGroup())) {
-            return; // do not validate in the current group
-        }
-        if (context.getCurrentOwner() != null && !this.owner.equals(context.getCurrentOwner())) {
-            return;
-        }
-        if (validator != null && !context.collectValidated(validator))
-            return; // already done
-
-        if (context.getMetaProperty() != null && !isReachable(context)) {
-            return;
-        }
-
-        // process composed constraints
-        if (isReportAsSingleViolation()) {
-            final ConstraintValidationListener<?> listener = context.getListener();
-            listener.beginReportAsSingle();
-
-            boolean failed = listener.hasViolations();
-            try {
-                // stop validating when already failed and
-                // ReportAsSingleInvalidConstraint = true ?
-                for (Iterator<ConstraintValidation<?>> composed = getComposingValidations().iterator(); !failed
-                    && composed.hasNext();) {
-                    composed.next().validate(context);
-                    failed = listener.hasViolations();
-                }
-            } finally {
-                listener.endReportAsSingle();
-                // Restore current constraint validation
-                context.setConstraintValidation(this);
-            }
-
-            if (failed) {
-                // TODO RSt - how should the composed constraint error report look like?
-                addErrors(context, new ConstraintValidatorContextImpl(context, this)); // add defaultErrorMessage only
-                return;
-            }
-        } else {
-            for (ConstraintValidation<?> composed : getComposingValidations()) {
-                composed.validate(context);
-            }
-
-            // Restore current constraint validation
-            context.setConstraintValidation(this);
-        }
-
-        if (validator != null) {
-            @SuppressWarnings("unchecked")
-            final ConstraintValidator<T, Object> objectValidator = (ConstraintValidator<T, Object>) validator;
-            final ConstraintValidatorContextImpl jsrContext = new ConstraintValidatorContextImpl(context, this);
-            if (!objectValidator.isValid(context.getValidatedValue(), jsrContext)) {
-                addErrors(context, jsrContext);
-            }
-        }
-    }
-
-    private <A extends Annotation> ConstraintValidator<A, ? super T> getConstraintValidator(
-        ConstraintValidatorFactory factory, A annotation,
-        Class<? extends ConstraintValidator<A, ?>>[] constraintClasses, Class<?> owner, AccessStrategy access) {
-        if (ObjectUtils.isNotEmpty(constraintClasses)) {
-            final Type type = determineTargetedType(owner, access);
-
-            /**
-             * spec says in chapter 3.5.3.: The ConstraintValidator chosen to
-             * validate a declared type T is the one where the type supported by
-             * the ConstraintValidator is a supertype of T and where there is no
-             * other ConstraintValidator whose supported type is a supertype of
-             * T and not a supertype of the chosen ConstraintValidator supported
-             * type.
-             */
-            final Map<Type, Collection<Class<? extends ConstraintValidator<A, ?>>>> validatorTypes =
-                getValidatorsTypes(constraintClasses);
-            reduceTarget(validatorTypes, access);
-
-            final List<Type> assignableTypes = new ArrayList<Type>(constraintClasses.length);
-            fillAssignableTypes(type, validatorTypes.keySet(), assignableTypes);
-            reduceAssignableTypes(assignableTypes);
-            checkOneType(assignableTypes, type, owner, annotation, access);
-
-            if ((type.equals(Object.class) || type.equals(Object[].class)) && validatorTypes.containsKey(Object.class)
-                && validatorTypes.containsKey(Object[].class)) {
-                throw new ConstraintDefinitionException(
-                    "Only a validator for Object or Object[] should be provided for cross-parameter validators");
-            }
-
-            final Collection<Class<? extends ConstraintValidator<A, ?>>> key =
-                validatorTypes.get(assignableTypes.get(0));
-            if (key.size() > 1) {
-                final String message = "Factory returned " + key.size() + " validators";
-                if (ParametersAccess.class.isInstance(access)) { // cross parameter
-                    throw new ConstraintDefinitionException(message);
-                }
-                throw new UnexpectedTypeException(message);
-            }
-
-            @SuppressWarnings("unchecked")
-            final ConstraintValidator<A, ? super T> validator =
-                (ConstraintValidator<A, ? super T>) factory.getInstance(key.iterator().next());
-            if (validator == null) {
-                throw new ValidationException("Factory returned null validator for: " + key);
-
-            }
-            return validator;
-            // NOTE: validator initialization deferred until append phase
-        }
-        return null;
-    }
-
-    private <A extends Annotation> void reduceTarget(
-        final Map<Type, Collection<Class<? extends ConstraintValidator<A, ?>>>> validator,
-        final AccessStrategy access) {
-        for (final Map.Entry<Type, Collection<Class<? extends ConstraintValidator<A, ?>>>> entry : validator
-            .entrySet()) {
-            final Collection<Class<? extends ConstraintValidator<A, ?>>> validators = entry.getValue();
-            final Iterator<Class<? extends ConstraintValidator<A, ?>>> it = validators.iterator();
-            while (it.hasNext()) {
-                final Type v = it.next();
-                if (!Class.class.isInstance(v)) {
-                    continue; // TODO: handle this case
-                }
-
-                final Class<?> clazz = Class.class.cast(v);
-                final SupportedValidationTarget target = clazz.getAnnotation(SupportedValidationTarget.class);
-                if (target != null) {
-                    final Collection<ValidationTarget> targets = Arrays.asList(target.value());
-                    final boolean isParameter =
-                        ParameterAccess.class.isInstance(access) || ParametersAccess.class.isInstance(access);
-                    if ((isParameter && !targets.contains(ValidationTarget.PARAMETERS))
-                        || (!isParameter && !targets.contains(ValidationTarget.ANNOTATED_ELEMENT))) {
-                        it.remove();
-                    }
-                }
-            }
-            if (validators.isEmpty()) {
-                validator.remove(entry.getKey());
-            }
-        }
-    }
-
-    private static void checkOneType(List<Type> types, Type targetType, Class<?> owner, Annotation anno,
-        AccessStrategy access) {
-
-        if (types.isEmpty()) {
-            final String message = "No validator could be found for type " + stringForType(targetType) + ". See: @"
-                + anno.annotationType().getSimpleName() + " at " + stringForLocation(owner, access);
-            if (Object[].class.equals(targetType)) { // cross parameter
-                throw new ConstraintDefinitionException(message);
-            }
-            throw new UnexpectedTypeException(message);
-        }
-        if (types.size() > 1) {
-            throw new UnexpectedTypeException(String.format(
-                "Ambiguous validators for type %s. See: @%s at %s. Validators are: %s",
-                stringForType(targetType),
-                anno.annotationType().getSimpleName(),
-                stringForLocation(owner, access), types.stream()
-                    .map(Object::toString).collect(Collectors.joining(", "))));
-        }
-    }
-
-    private static String stringForType(Type clazz) {
-        if (clazz instanceof Class<?>) {
-            return ((Class<?>) clazz).isArray() ? ((Class<?>) clazz).getComponentType().getName() + "[]"
-                : ((Class<?>) clazz).getName();
-        }
-        return clazz.toString();
-    }
-
-    private static String stringForLocation(Class<?> owner, AccessStrategy access) {
-        return access == null ? owner.getName() : access.toString();
-    }
-
-    private static void fillAssignableTypes(Type type, Set<Type> validatorsTypes, List<Type> suitableTypes) {
-        for (final Type validatorType : validatorsTypes) {
-            if (TypeUtils.isAssignable(type, validatorType) && !suitableTypes.contains(validatorType)) {
-                suitableTypes.add(validatorType);
-            }
-        }
-    }
-
-    /**
-     * Tries to reduce all assignable classes down to a single class.
-     *
-     * @param assignableTypes The set of all classes which are assignable to the class of
-     *                        the value to be validated and which are handled by at least
-     *                        one of the validators for the specified constraint.
-     */
-    private static void reduceAssignableTypes(List<Type> assignableTypes) {
-        if (assignableTypes.size() <= 1) {
-            return; // no need to reduce
-        }
-        boolean removed = false;
-        do {
-            final Type type = assignableTypes.get(0);
-            for (int i = 1; i < assignableTypes.size(); i++) {
-                final Type nextType = assignableTypes.get(i);
-                if (TypeUtils.isAssignable(nextType, type)) {
-                    assignableTypes.remove(0);
-                    i--;
-                    removed = true;
-                } else if (TypeUtils.isAssignable(type, nextType)) {
-                    assignableTypes.remove(i--);
-                    removed = true;
-                }
-            }
-        } while (removed && assignableTypes.size() > 1);
-    }
-
-    private static <A extends Annotation> Map<Type, Collection<Class<? extends ConstraintValidator<A, ?>>>> getValidatorsTypes(
-        Class<? extends ConstraintValidator<A, ?>>[] constraintValidatorClasses) {
-        final Map<Type, Collection<Class<? extends ConstraintValidator<A, ?>>>> validatorsTypes =
-            new HashMap<Type, Collection<Class<? extends ConstraintValidator<A, ?>>>>();
-        for (Class<? extends ConstraintValidator<A, ?>> validatorType : constraintValidatorClasses) {
-            Type validatedType = TypeUtils.getTypeArguments(validatorType, ConstraintValidator.class)
-                .get(ConstraintValidator.class.getTypeParameters()[1]);
-            if (validatedType == null) {
-                throw new ValidationException(String.format("Could not detect validated type for %s", validatorType));
-            }
-            if (validatedType instanceof GenericArrayType) {
-                final Type componentType = TypeUtils.getArrayComponentType(validatedType);
-                if (componentType instanceof Class<?>) {
-                    validatedType = Array.newInstance((Class<?>) componentType, 0).getClass();
-                }
-            }
-            if (!validatorsTypes.containsKey(validatedType)) {
-                validatorsTypes.put(validatedType, new ArrayList<Class<? extends ConstraintValidator<A, ?>>>());
-            }
-            validatorsTypes.get(validatedType).add(validatorType);
-        }
-        return validatorsTypes;
-    }
-
-    /**
-     * implements spec chapter 3.5.3. ConstraintValidator resolution algorithm.
-     */
-    private static Type determineTargetedType(Class<?> owner, AccessStrategy access) {
-        // if the constraint declaration is hosted on a class or an interface,
-        // the targeted type is the class or the interface.
-        if (access == null) {
-            return owner;
-        }
-        final Type type = access.getJavaType();
-        if (type == null) {
-            return Object.class;
-        }
-        return type instanceof Class<?> ? Reflection.primitiveToWrapper((Class<?>) type) : type;
-    }
-
-    /**
-     * Initialize the validator (if not <code>null</code>) with the stored
-     * annotation.
-     */
-    public void initialize() {
-        if (null != validator) {
-            try {
-                validator.initialize(annotation);
-            } catch (RuntimeException e) {
-                // Either a "legit" problem initializing the validator or a
-                // ClassCastException if the validator associated annotation is
-                // not a supertype of the validated annotation.
-                throw new ConstraintDefinitionException(
-                    "Incorrect validator [" + validator.getClass().getCanonicalName() + "] for annotation "
-                        + annotation.annotationType().getCanonicalName(),
-                    e);
-            }
-        }
-    }
-
-    private boolean isReachable(GroupValidationContext<?> context) {
-        final PathImpl path = context.getPropertyPath();
-        final NodeImpl node = path.getLeafNode();
-        PathImpl beanPath = path.getPathWithoutLeafNode();
-        if (beanPath == null) {
-            beanPath = PathImpl.create();
-        }
-        try {
-            if (!context.getTraversableResolver().isReachable(context.getBean(), node,
-                context.getRootMetaBean().getBeanClass(), beanPath, access.getElementType())) {
-                return false;
-            }
-        } catch (RuntimeException e) {
-            throw new ValidationException("Error in TraversableResolver.isReachable() for " + context.getBean(), e);
-        }
-        return true;
-    }
-
-    private void addErrors(GroupValidationContext<?> context, ConstraintValidatorContextImpl jsrContext) {
-        for (ValidationListener.Error each : jsrContext.getErrorMessages()) {
-            context.getListener().addError(each, context);
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
-        return "ConstraintValidation{" + validator + '}';
-    }
-
-    /**
-     * Get the message template used by this constraint.
-     *
-     * @return String
-     */
-    @Override
-    public String getMessageTemplate() {
-        return ConstraintAnnotationAttributes.MESSAGE.get(attributes);
-    }
-
-    public ConstraintValidator<T, ?> getValidator() {
-        return validator;
-    }
-
-    protected boolean isMemberOf(Class<?> reqGroup) {
-        return groups.contains(reqGroup);
-    }
-
-    public Class<?> getOwner() {
-        return owner;
-    }
-
-    @Override
-    public T getAnnotation() {
-        return annotation;
-    }
-
-    public AccessStrategy getAccess() {
-        return access;
-    }
-
-    public void setAnnotation(T annotation) {
-        this.annotation = annotation;
-    }
-
-    // ///////////////////////// ConstraintDescriptor implementation
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Map<String, Object> getAttributes() {
-        return attributes;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public Set<ConstraintDescriptor<?>> getComposingConstraints() {
-        if (composedConstraints == null) {
-            return Collections.emptySet();
-        }
-        final Set result = composedConstraints;
-        return result;
-    }
-
-    /**
-     * Get the composing {@link ConstraintValidation} objects. This is
-     * effectively an implementation-specific analogue to
-     * {@link #getComposingConstraints()}.
-     *
-     * @return {@link Set} of {@link ConstraintValidation}
-     */
-    Set<ConstraintValidation<?>> getComposingValidations() {
-        return composedConstraints == null ? Collections.<ConstraintValidation<?>> emptySet() : composedConstraints;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Set<Class<?>> getGroups() {
-        return groups;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Set<Class<? extends Payload>> getPayload() {
-        return payload;
-    }
-
-    @Override
-    public ConstraintTarget getValidationAppliesTo() {
-        return validationAppliesTo;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public List<Class<? extends ConstraintValidator<T, ?>>> getConstraintValidatorClasses() {
-        return validatorClasses == null ? Collections.<Class<? extends ConstraintValidator<T, ?>>> emptyList()
-            : Arrays.asList(validatorClasses);
-    }
-
-    public void setValidationAppliesTo(final ConstraintTarget validationAppliesTo) {
-        this.validationAppliesTo = validationAppliesTo;
-    }
-
-    public boolean isValidated() {
-        return validated;
-    }
-
-    public void setValidated(final boolean validated) {
-        this.validated = validated;
-    }
-
-    @Override
-    public ValidateUnwrappedValue getValueUnwrapping() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public <U> U unwrap(Class<U> arg0) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidationListener.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidationListener.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidationListener.java
deleted file mode 100644
index 7d7ec8b..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidationListener.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.jsr.util.PathImpl;
-import org.apache.bval.model.ValidationContext;
-import org.apache.bval.model.ValidationListener;
-
-import javax.validation.ConstraintViolation;
-import javax.validation.ElementKind;
-import javax.validation.MessageInterpolator;
-import javax.validation.Path;
-import javax.validation.metadata.ConstraintDescriptor;
-import java.lang.annotation.ElementType;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-/**
- * Description: JSR-303 {@link ValidationListener} implementation; provides {@link ConstraintViolation}s.<br/>
- * 
- * @version $Rev: 1503686 $ $Date: 2013-07-16 14:38:56 +0200 (mar., 16 juil. 2013) $
- */
-public final class ConstraintValidationListener<T> implements ValidationListener {
-    private final Set<ConstraintViolation<T>> constraintViolations = new HashSet<ConstraintViolation<T>>();
-    private final T rootBean;
-    private final Class<T> rootBeanType;
-    // the validation process is single-threaded and it's unlikely to change in the near future (otherwise use AtomicInteger).
-    private int compositeDepth = 0;
-    private boolean hasCompositeError;
-
-    /**
-     * Create a new ConstraintValidationListener instance.
-     * @param aRootBean
-     * @param rootBeanType
-     */
-    public ConstraintValidationListener(T aRootBean, Class<T> rootBeanType) {
-        this.rootBean = aRootBean;
-        this.rootBeanType = rootBeanType;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <VL extends ValidationListener> void addError(String reason, ValidationContext<VL> context) {
-        addError(reason, null, context);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <VL extends ValidationListener> void addError(Error error, ValidationContext<VL> context) {
-        if (error.getOwner() instanceof Path) {
-            addError(error.getReason(), (Path) error.getOwner(), context);
-        } else {
-            addError(error.getReason(), null, context);
-        }
-    }
-
-    private void addError(String messageTemplate, Path propPath, ValidationContext<?> context) {
-        if (compositeDepth > 0) {
-            hasCompositeError |= true;
-            return;
-        }
-        final Object value;
-
-        final ConstraintDescriptor<?> descriptor;
-        final String message;
-        if (context instanceof GroupValidationContext<?>) {
-            GroupValidationContext<?> gcontext = (GroupValidationContext<?>) context;
-            value = gcontext.getValidatedValue();
-            if (gcontext instanceof MessageInterpolator.Context) {
-                message =
-                    gcontext.getMessageResolver().interpolate(messageTemplate, (MessageInterpolator.Context) gcontext);
-            } else {
-                message = gcontext.getMessageResolver().interpolate(messageTemplate, null);
-            }
-            descriptor = gcontext.getConstraintValidation().asSerializableDescriptor();
-            if (propPath == null)
-                propPath = gcontext.getPropertyPath();
-        } else {
-            if (context.getMetaProperty() == null)
-                value = context.getBean();
-            else
-                value = context.getPropertyValue();
-            message = messageTemplate;
-            if (propPath == null)
-                propPath = PathImpl.createPathFromString(context.getPropertyName());
-            descriptor = null;
-        }
-        ElementType elementType = (context.getAccess() != null) ? context.getAccess().getElementType() : null;
-
-        final Object[] parameters;
-        Object leaf;
-        Object returnValue;
-        T rootBean;
-        if (GroupValidationContext.class.isInstance(context)) { // TODO: clean up it but it would need to rework completely our context - get rid of it would be the best
-            final GroupValidationContext<T> ctx = GroupValidationContext.class.cast(context);
-            final ElementKind elementKind = ctx.getElementKind();
-            final Iterator<Path.Node> it = propPath.iterator();
-            final ElementKind kind = propPath.iterator().next().getKind();
-
-            returnValue = ctx.getReturnValue();
-
-            if (ElementKind.CONSTRUCTOR.equals(kind)) {
-                rootBean = null;
-                leaf = context.getBean();
-                returnValue = this.rootBean; // switch back return value and rootBean
-            } else if (ElementKind.METHOD.equals(kind)) {
-                if (ElementKind.RETURN_VALUE.equals(elementKind)) { // switch back return value and rootBean
-                    rootBean = (T) returnValue;
-                    if (kindOf(propPath, ElementKind.RETURN_VALUE)) {
-                        leaf = returnValue;
-                        returnValue = this.rootBean;
-                    } else {
-                        leaf = this.rootBean;
-                        returnValue = this.rootBean;
-                    }
-                } else {
-                    rootBean = this.rootBean;
-                    if (kindOf(propPath, ElementKind.PARAMETER, ElementKind.CROSS_PARAMETER)) {
-                        leaf = rootBean;
-                    } else {
-                        leaf = context.getBean();
-                    }
-                }
-            } else {
-                rootBean = this.rootBean;
-                leaf = context.getBean();
-            }
-
-            if (ElementKind.CONSTRUCTOR.equals(kind)
-                && (ElementKind.CROSS_PARAMETER.equals(elementKind) || ElementKind.PARAMETER.equals(elementKind))
-                && (it.hasNext() && it.next() != null && it.hasNext() && it.next() != null && !it.hasNext())) { // means inherited validation use real value
-                leaf = null;
-            }
-
-            parameters = ctx.getParameters();
-        } else {
-            leaf = context.getBean();
-            returnValue = null;
-            parameters = null;
-            rootBean = this.rootBean;
-        }
-
-        constraintViolations.add(new ConstraintViolationImpl<T>(messageTemplate, message, rootBean, leaf, propPath,
-            value, descriptor, rootBeanType, elementType, returnValue, parameters));
-    }
-
-    private static boolean kindOf(final Path propPath, final ElementKind... kinds) {
-        final Iterator<Path.Node> node = propPath.iterator();
-        boolean isParam = false;
-        while (node.hasNext()) {
-            final ElementKind current = node.next().getKind();
-            isParam = false;
-            for (final ElementKind k : kinds) {
-                if (k.equals(current)) {
-                    isParam = true;
-                    break;
-                }
-            }
-        }
-        return isParam;
-    }
-
-    /**
-     * Get the {@link ConstraintViolation}s accumulated by this {@link ConstraintValidationListener}.
-     * @return {@link Set} of {@link ConstraintViolation}
-     */
-    public Set<ConstraintViolation<T>> getConstraintViolations() {
-        return constraintViolations;
-    }
-
-    /**
-     * Learn whether no violations were found. 
-     * @return boolean
-     */
-    public boolean isEmpty() {
-        return constraintViolations.isEmpty();
-    }
-
-    /**
-     * Get the root bean.
-     * @return T
-     */
-    public T getRootBean() {
-        return rootBean;
-    }
-
-    /**
-     * Get the root bean type of this {@link ConstraintValidationListener}.
-     * @return Class<T>
-     */
-    public Class<T> getRootBeanType() {
-        return rootBeanType;
-    }
-
-    /**
-     * Get the count of encountered violations.
-     * @return int
-     */
-    public int violationsSize() {
-        return constraintViolations.size();
-    }
-
-    /**
-     * Learn whether there are violations available.
-     * If in report-as-single-violation mode, the result is scoped accordingly.
-     * Note that this means you must check before exiting report-as-single-violation mode
-     * @return boolean
-     */
-    public boolean hasViolations() {
-        return compositeDepth == 0 ? !constraintViolations.isEmpty() : hasCompositeError;
-    }
-
-    /**
-     * Signify the beginning of a report-as-single-violation composite validation.
-     * @return <code>true</code> as this call caused the listener to enter report-as-single-violation mode
-     */
-    public boolean beginReportAsSingle() {
-        return ++compositeDepth == 1;
-    }
-
-    /**
-     * Signify the end of a report-as-single-violation composite validation.
-     * @return <code>true</code> as this call caused the listener to exit report-as-single-violation mode
-     */
-    public boolean endReportAsSingle() {
-        boolean endOutMostReportAsSingle = (--compositeDepth == 0);
-        if (endOutMostReportAsSingle) {
-            hasCompositeError = false;
-        }
-        return endOutMostReportAsSingle;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorContextImpl.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorContextImpl.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorContextImpl.java
deleted file mode 100644
index 74c8685..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorContextImpl.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.jsr.util.LeafNodeBuilderCustomizableContextImpl;
-import org.apache.bval.jsr.util.NodeBuilderCustomizableContextImpl;
-import org.apache.bval.jsr.util.NodeBuilderDefinedContextImpl;
-import org.apache.bval.jsr.util.NodeImpl;
-import org.apache.bval.jsr.util.PathImpl;
-import org.apache.bval.model.ValidationListener;
-
-import javax.validation.ClockProvider;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-import javax.validation.Path;
-import javax.validation.ValidationException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Description: Short-lived {@link ConstraintValidatorContext} implementation passed by
- * a {@link ConstraintValidation} to its adapted {@link ConstraintValidator}. <br/>
- */
-@Deprecated
-public class ConstraintValidatorContextImpl
-    extends org.apache.bval.jsr.job.ConstraintValidatorContextImpl<Object>
-    implements ConstraintValidatorContext {
-    private final List<ValidationListener.Error> errorMessages = new LinkedList<ValidationListener.Error>();
-
-    private final ConstraintValidation<?> constraintDescriptor;
-    private final GroupValidationContext<?> validationContext;
-
-    private boolean defaultDisabled;
-
-    /**
-     * Create a new ConstraintValidatorContextImpl instance.
-     * @param validationContext
-     * @param aConstraintValidation
-     */
-    public ConstraintValidatorContextImpl(GroupValidationContext<?> validationContext,
-        ConstraintValidation<?> aConstraintValidation) {
-        super();
-        this.validationContext = validationContext;
-        this.constraintDescriptor = aConstraintValidation;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void disableDefaultConstraintViolation() {
-        defaultDisabled = true;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getDefaultConstraintMessageTemplate() {
-        return constraintDescriptor.getMessageTemplate();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ConstraintViolationBuilder buildConstraintViolationWithTemplate(String messageTemplate) {
-        return new ConstraintViolationBuilderImpl(this, messageTemplate, validationContext.getPropertyPath());
-    }
-
-    @Override
-    public <T> T unwrap(Class<T> type) {
-        if (type.isInstance(this)) {
-            return type.cast(this);
-        }
-        throw new ValidationException("Type " + type + " not supported");
-    }
-
-    private static final class ConstraintViolationBuilderImpl
-        implements ConstraintValidatorContext.ConstraintViolationBuilder {
-        private final ConstraintValidatorContextImpl parent;
-        private final String messageTemplate;
-        private final PathImpl propertyPath;
-
-        /**
-         * Create a new ConstraintViolationBuilderImpl instance.
-         * @param contextImpl
-         * @param template
-         * @param path
-         */
-        ConstraintViolationBuilderImpl(ConstraintValidatorContextImpl contextImpl, String template, PathImpl path) {
-            parent = contextImpl;
-            messageTemplate = template;
-            propertyPath = path;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public NodeBuilderDefinedContext addNode(String name) {
-            PathImpl path;
-            if (propertyPath.isRootPath()) {
-                path = PathImpl.create();
-                path.getLeafNode().setName(name);
-            } else {
-                path = PathImpl.copy(propertyPath);
-                path.addNode(new NodeImpl.PropertyNodeImpl(name));
-            }
-            return new NodeBuilderDefinedContextImpl(parent, messageTemplate, path);
-        }
-
-        @Override
-        public NodeBuilderCustomizableContext addPropertyNode(String name) {
-            return new NodeBuilderCustomizableContextImpl(parent, messageTemplate, propertyPath, name);
-        }
-
-        @Override
-        public LeafNodeBuilderCustomizableContext addBeanNode() {
-            return new LeafNodeBuilderCustomizableContextImpl(parent, messageTemplate, propertyPath);
-        }
-
-        @Override
-        public NodeBuilderDefinedContext addParameterNode(int index) {
-            final Method method = parent.validationContext.getMethod();
-            final List<String> parameters =
-                parent.validationContext.getParameterNameProvider().getParameterNames(method);
-            final NodeImpl node = new NodeImpl.ParameterNodeImpl(parameters.get(index), index);
-            if (!propertyPath.isRootPath()) {
-                propertyPath.removeLeafNode();
-            }
-            propertyPath.addNode(node);
-            return new NodeBuilderDefinedContextImpl(parent, messageTemplate, propertyPath);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public ConstraintValidatorContext addConstraintViolation() {
-            parent.addError(messageTemplate, propertyPath);
-            return parent;
-        }
-
-        @Override
-        public ContainerElementNodeBuilderCustomizableContext addContainerElementNode(
-            String arg0, Class<?> arg1, Integer arg2) {
-            // TODO Auto-generated method stub
-            return null;
-        }
-    }
-
-    /**
-     * Get the queued error messages.
-     * @return List
-     */
-    public List<ValidationListener.Error> getErrorMessages() {
-        if (defaultDisabled && errorMessages.isEmpty()) {
-            throw new ValidationException(
-                "At least one custom message must be created if the default error message gets disabled.");
-        }
-
-        List<ValidationListener.Error> returnedErrorMessages = new ArrayList<ValidationListener.Error>(errorMessages);
-        if (!defaultDisabled) {
-            returnedErrorMessages.add(new ValidationListener.Error(getDefaultConstraintMessageTemplate(),
-                validationContext.getPropertyPath(), null));
-        }
-        return returnedErrorMessages;
-    }
-
-    /**
-     * Get this {@link ConstraintValidatorContext}'s {@link GroupValidationContext}.
-     * @return {@link GroupValidationContext}
-     */
-    public GroupValidationContext<?> getValidationContext() {
-        return validationContext;
-    }
-
-    /**
-     * Add an error message to this {@link ConstraintValidatorContext}.
-     * @param messageTemplate
-     * @param propertyPath
-     */
-    public void addError(String messageTemplate, Path propertyPath) {
-        errorMessages.add(new ValidationListener.Error(messageTemplate, propertyPath, null));
-    }
-
-    @Override
-    public ClockProvider getClockProvider() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorIdentity.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorIdentity.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorIdentity.java
deleted file mode 100644
index 572c39a..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintValidatorIdentity.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.bval.jsr;
-
-import java.util.Objects;
-
-import javax.validation.ConstraintValidator;
-import javax.validation.Path;
-
-/**
- * Class that stores the needed properties to ensure that a validation is not
- * checked more than once.
- * <p>
- * These properties are:
- * <ul>
- * <li>The ref of the bean to which the validation would be applied.</li>
- * <li>The path of the property.</li>
- * <li>The ref of the {@link ConstraintValidator}.</li>
- * </ul>
- * 
- * @author Carlos Vara
- */
-final class ConstraintValidatorIdentity {
-
-    private final Object bean;
-    private final Path path;
-    private final ConstraintValidator<?, ?> constraintValidator;
-
-    /**
-     * Create a new ConstraintValidatorIdentity instance.
-     * @param bean
-     * @param path
-     * @param constraintValidator
-     */
-    public ConstraintValidatorIdentity(Object bean, Path path, ConstraintValidator<?, ?> constraintValidator) {
-        this.bean = bean;
-        this.path = path;
-        this.constraintValidator = constraintValidator;
-    }
-
-    /**
-     * Get the referenced bean.
-     * @return Object
-     */
-    public Object getBean() {
-        return bean;
-    }
-
-    /**
-     * Get the referenced property {@link Path}.
-     * @return Path
-     */
-    public Path getPath() {
-        return path;
-    }
-
-    /**
-     * Get the associated {@link ConstraintValidator}.
-     * @return {@link ConstraintValidator}
-     */
-    public ConstraintValidator<?, ?> getConstraintValidator() {
-        return constraintValidator;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean equals(Object obj) {
-
-        if (this == obj) {
-            return true;
-        }
-
-        if (obj == null) {
-            return false;
-        }
-
-        if (!(obj instanceof ConstraintValidatorIdentity)) {
-            return false;
-        }
-
-        ConstraintValidatorIdentity other = (ConstraintValidatorIdentity) obj;
-
-        // Bean ref must be the same
-        if (this.bean != other.bean) {
-            return false;
-        }
-
-        // ConstraintValidator ref must be the same
-        if (this.constraintValidator != other.constraintValidator) {
-            return false;
-        }
-
-        // Path must be equals
-        if (!this.path.equals(other.path)) {
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int hashCode() {
-        return Objects.hash(bean, path, constraintValidator);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintViolationImpl.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintViolationImpl.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintViolationImpl.java
index 91ae20d..15f754d 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintViolationImpl.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintViolationImpl.java
@@ -83,7 +83,8 @@ public class ConstraintViolationImpl<T> implements ConstraintViolation<T>, Seria
         this.elementType = elementType;
         this.returnValue = returnValue;
         this.parameters = parameters;
-        this.hashCode = computeHashCode();
+        this.hashCode = Arrays.deepHashCode(new Object[] { messageTemplate, message, rootBean, rootBeanClass, leafBean,
+            value, propertyPath, elementType, constraintDescriptor, returnValue, parameters });
     }
 
     /**
@@ -208,11 +209,4 @@ public class ConstraintViolationImpl<T> implements ConstraintViolation<T>, Seria
     public int hashCode() {
         return hashCode;
     }
-
-    private int computeHashCode() {
-        int result = Objects.hash(messageTemplate, message, rootBean, rootBeanClass, leafBean, value, propertyPath,
-            elementType, constraintDescriptor, returnValue);
-        result = 31 * result + (parameters == null ? 0 : Arrays.hashCode(parameters));
-        return result;
-    }
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ConstructorDescriptorImpl.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstructorDescriptorImpl.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ConstructorDescriptorImpl.java
deleted file mode 100644
index d947a92..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstructorDescriptorImpl.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.MetaConstructor;
-import org.apache.bval.model.Validation;
-
-import javax.validation.metadata.ConstructorDescriptor;
-
-/**
- * Description: {@link javax.validation.metadata.ConstructorDescriptor} implementation.<br/>
- */
-public class ConstructorDescriptorImpl extends InvocableElementDescriptor
-    implements ConstructorDescriptor, ProcedureDescriptor {
-    /**
-     * Create a new ConstructorDescriptorImpl instance.
-     * @param metaBean
-     * @param validations
-     */
-    protected ConstructorDescriptorImpl(MetaBean metaBean, Validation[] validations) {
-        super(metaBean, metaBean.getBeanClass(), validations);
-    }
-
-    public ConstructorDescriptorImpl(final MetaBean metaBean, final MetaConstructor metaMethod) {
-        super(metaBean, metaBean.getBeanClass(), new Validation[0]);
-        setCascaded(false);
-    }
-
-    @Override
-    public String getName() {
-        return elementClass.getSimpleName();
-    }
-
-    @Override
-    public boolean hasConstraints() {
-        return false;
-    }
-
-    @Override
-    public boolean hasConstrainedParameters() {
-        return super.hasConstrainedParameters();
-    }
-
-    @Override
-    public boolean hasConstrainedReturnValue() {
-        return super.hasConstrainedReturnValue();
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/CrossParameterDescriptorImpl.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/CrossParameterDescriptorImpl.java b/bval-jsr/src/main/java/org/apache/bval/jsr/CrossParameterDescriptorImpl.java
deleted file mode 100644
index c14e102..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/CrossParameterDescriptorImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.model.MetaBean;
-
-import javax.validation.metadata.CrossParameterDescriptor;
-import java.util.Collection;
-
-public class CrossParameterDescriptorImpl extends ElementDescriptorImpl implements CrossParameterDescriptor {
-    public CrossParameterDescriptorImpl(final MetaBean bean, final Collection<ConstraintValidation<?>> list) {
-        super(bean, Object[].class, list.toArray(new ConstraintValidation<?>[list.size()]));
-    }
-
-    @Override
-    public boolean hasConstraints() {
-        return !getConstraintDescriptors().isEmpty();
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ElementDescriptorImpl.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ElementDescriptorImpl.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ElementDescriptorImpl.java
deleted file mode 100644
index cfcf85b..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ElementDescriptorImpl.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.jsr.groups.Group;
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.Validation;
-
-import javax.validation.ConstraintDeclarationException;
-import javax.validation.metadata.ConstraintDescriptor;
-import javax.validation.metadata.ElementDescriptor;
-import javax.validation.metadata.GroupConversionDescriptor;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
-
-/**
- * Description: MetaData class<br/>
- */
-public abstract class ElementDescriptorImpl implements ElementDescriptor {
-    private final Set<GroupConversionDescriptor> groupConversions =
-        new CopyOnWriteArraySet<GroupConversionDescriptor>();
-    private boolean cascaded;
-    private final Collection<Object> validated = new CopyOnWriteArraySet<Object>();
-
-    /**
-     * Get a set of {@link ConstraintDescriptor}s from the specified array of
-     * {@link Validation}s.
-     * 
-     * @param validations
-     * @return {@link ConstraintDescriptor} set
-     */
-    protected static Set<ConstraintDescriptor<?>> getConstraintDescriptors(final Validation[] validations) {
-        final Set<ConstraintDescriptor<?>> result = new HashSet<ConstraintDescriptor<?>>(validations.length);
-        for (Validation validation : validations) {
-            if (validation instanceof ConstraintValidation<?>) {
-                result.add((ConstraintValidation<?>) validation);
-            }
-        }
-        return result;
-    }
-
-    /** the MetaBean of this element */
-    protected final MetaBean metaBean;
-
-    /** the raw type of this element */
-    protected final Class<?> elementClass;
-
-    private Set<ConstraintDescriptor<?>> constraintDescriptors;
-
-    private final Map<Group, Group> groupMapping = new HashMap<Group, Group>();
-
-    /**
-     * Create a new ElementDescriptorImpl instance.
-     * 
-     * @param metaBean
-     * @param elementClass
-     * @param validations
-     */
-    protected ElementDescriptorImpl(MetaBean metaBean, Class<?> elementClass, Validation[] validations) {
-        this.metaBean = metaBean;
-        this.elementClass = elementClass;
-        setConstraintDescriptors(getConstraintDescriptors(validations));
-    }
-
-    /**
-     * Create a new ElementDescriptorImpl instance.
-     *
-     * @param elementClass
-     * @param validations
-     */
-    protected ElementDescriptorImpl(Class<?> elementClass, Validation[] validations) {
-        this(null, elementClass, validations);
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @return Statically defined returned type.
-     */
-    @Override
-    public Class<?> getElementClass() {
-        return elementClass;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public ElementDescriptor.ConstraintFinder findConstraints() {
-        return new ConstraintFinderImpl(metaBean, new HashSet(constraintDescriptors));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Set<ConstraintDescriptor<?>> getConstraintDescriptors() {
-        return constraintDescriptors.isEmpty() ? Collections.<ConstraintDescriptor<?>> emptySet()
-            : Collections.unmodifiableSet(constraintDescriptors);
-    }
-
-    /**
-     * Get the mutable {@link ConstraintDescriptor} {@link Set}.
-     * 
-     * @return Set of {@link ConstraintDescriptor}
-     */
-    public Set<ConstraintDescriptor<?>> getMutableConstraintDescriptors() {
-        return constraintDescriptors;
-    }
-
-    /**
-     * {@inheritDoc} return true if at least one constraint declaration is
-     * present on the element.
-     */
-    @Override
-    public boolean hasConstraints() {
-        return !getConstraintDescriptors().isEmpty();
-    }
-
-    /**
-     * Set the constraintDescriptors for this element.
-     * 
-     * @param constraintDescriptors
-     *            to set
-     */
-    public void setConstraintDescriptors(Set<ConstraintDescriptor<?>> constraintDescriptors) {
-        this.constraintDescriptors = constraintDescriptors;
-    }
-
-    /**
-     * Get the model {@link MetaBean} used.
-     * 
-     * @return MetaBean
-     */
-    public MetaBean getMetaBean() {
-        return metaBean;
-    }
-
-    public void addGroupMapping(final Group from, final Group to) {
-        groupMapping.put(from, to);
-    }
-
-    public Group mapGroup(final Group current) {
-        final Group mapping = groupMapping.get(current);
-        if (mapping != null) {
-            return mapping;
-        }
-        return current;
-    }
-
-    public Set<GroupConversionDescriptor> getGroupConversions() {
-        return groupConversions;
-    }
-
-    public void addGroupConversion(final GroupConversionDescriptor descriptor) {
-        groupConversions.add(descriptor);
-        final Group from = new Group(descriptor.getFrom());
-        if (mapGroup(from) != from) { // ref == is fine
-            throw new ConstraintDeclarationException("You can't map twice from the same group");
-        }
-        addGroupMapping(from, new Group(descriptor.getTo()));
-    }
-
-    public boolean isCascaded() {
-        return cascaded;
-    }
-
-    public void setCascaded(final boolean cascaded) {
-        this.cascaded = cascaded;
-    }
-
-    public boolean isValidated(final Object object) {
-        return validated.contains(object);
-    }
-
-    public void setValidated(final Object object) {
-        this.validated.add(object);
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/GraphBeanIdentity.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/GraphBeanIdentity.java b/bval-jsr/src/main/java/org/apache/bval/jsr/GraphBeanIdentity.java
deleted file mode 100644
index 26391e6..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/GraphBeanIdentity.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.    
- */
-package org.apache.bval.jsr;
-
-import java.util.Objects;
-
-/**
- * Class that stores the needed properties to avoid circular paths when
- * validating an object graph.
- * <p>
- * These properties are:
- * <ul>
- * <li>The ref of the bean to which the validation would be applied.</li>
- * <li>The current group being validated.</li>
- * </ul>
- * 
- * FIXME: Owner is currently not used in identity checking, and probably
- * never will be.  So it is likely to be deleted.
- * 
- * @author Carlos Vara
- */
-public class GraphBeanIdentity {
-
-    private final Object bean;
-    private final Class<?> group;
-    private final Class<?> owner;
-
-    /**
-     * Create a new GraphBeanIdentity instance.
-     * @param bean
-     * @param group
-     * @param owner
-     */
-    public GraphBeanIdentity(Object bean, Class<?> group, Class<?> owner) {
-        this.bean = bean;
-        this.group = group;
-        this.owner = owner;
-    }
-
-    /**
-     * Get the bean.
-     * @return Object
-     */
-    public Object getBean() {
-        return bean;
-    }
-
-    /**
-     * Get the group being validated.
-     * @return Class
-     */
-    public Class<?> getGroup() {
-        return group;
-    }
-
-    /**
-     * Get the owning class
-     * @return
-     */
-    public Class<?> getOwner() {
-        return owner;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!(obj instanceof GraphBeanIdentity)) {
-            return false;
-        }
-        GraphBeanIdentity other = (GraphBeanIdentity) obj;
-
-        // Bean ref must be the same; Group ref must be the same
-        return bean == other.bean && group == other.group;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int hashCode() {
-        return Objects.hash(bean, group);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/GroupValidationContext.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/GroupValidationContext.java b/bval-jsr/src/main/java/org/apache/bval/jsr/GroupValidationContext.java
deleted file mode 100644
index fecfd8d..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/GroupValidationContext.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.jsr.groups.Group;
-import org.apache.bval.jsr.groups.Groups;
-import org.apache.bval.jsr.util.PathImpl;
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.ValidationContext;
-
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorFactory;
-import javax.validation.ElementKind;
-import javax.validation.MessageInterpolator;
-import javax.validation.ParameterNameProvider;
-import javax.validation.Path;
-import javax.validation.TraversableResolver;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-
-/**
- * Description: JSR-303 {@link ValidationContext} extension. <br/>
- */
-public interface GroupValidationContext<T> extends ValidationContext<ConstraintValidationListener<T>> {
-
-    /**
-     * Get the groups of this {@link GroupValidationContext}.
-     * @return the groups in their sequence for validation
-     */
-    Groups getGroups();
-
-    void setCurrentGroups(Groups groups);
-
-    /**
-     * Set the current {@link Group}.
-     * @param group to set
-     */
-    void setCurrentGroup(Group group);
-
-    /**
-     * Get the current {@link Group}.
-     * @return Group
-     */
-    Group getCurrentGroup();
-
-    /**
-     * Get the property path.
-     * @return {@link PathImpl}
-     */
-    PathImpl getPropertyPath();
-
-    /**
-     * Get the root {@link MetaBean}.
-     * @return {@link MetaBean}
-     */
-    MetaBean getRootMetaBean();
-
-    /**
-     * Set the {@link ConstraintValidation}.
-     * @param constraint to set
-     */
-    void setConstraintValidation(ConstraintValidation<?> constraint);
-
-    /**
-     * Get the {@link ConstraintValidation}.
-     * @return {@link ConstraintValidation}
-     */
-    ConstraintValidation<?> getConstraintValidation();
-
-    /**
-     * Get the value being validated.
-     * @return Object
-     */
-    Object getValidatedValue();
-
-    /**
-     * Set a fixed value for the context.
-     * @param value to set
-     */
-    void setFixedValue(Object value);
-
-    /**
-     * Get the message resolver.
-     * @return {@link MessageInterpolator}
-     */
-    MessageInterpolator getMessageResolver();
-
-    /**
-     * Get the {@link TraversableResolver}.
-     * @return {@link TraversableResolver}
-     */
-    TraversableResolver getTraversableResolver();
-
-    /**
-     * Get the {@link ConstraintValidatorFactory}.
-     * @return {@link ConstraintValidatorFactory}
-     */
-    ConstraintValidatorFactory getConstraintValidatorFactory();
-
-    /**
-     * Accumulate a validated constraint.
-     * @param constraint
-     * @return true when the constraint for the object in this path was not
-     *         already validated in this context
-     */
-    boolean collectValidated(ConstraintValidator<?, ?> constraint);
-
-    /**
-     * Get the current owning class.
-     * @return Class
-     */
-    Class<?> getCurrentOwner();
-
-    /**
-     * Set the current owning class.
-     * @param currentOwner to set
-     */
-    void setCurrentOwner(Class<?> currentOwner);
-
-    void setKind(ElementKind type);
-
-    ElementKind getElementKind();
-
-    Object getReturnValue();
-
-    Object[] getParameters();
-
-    void setParameters(Object[] parameters);
-
-    void setReturnValue(Object returnValue);
-
-    ParameterNameProvider getParameterNameProvider();
-
-    void setMethod(Method method);
-
-    Method getMethod();
-
-    void setConstructor(Constructor<?> method);
-
-    Constructor<?> getConstructor();
-
-    void moveDown(Path.Node node);
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/GroupValidationContextImpl.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/GroupValidationContextImpl.java b/bval-jsr/src/main/java/org/apache/bval/jsr/GroupValidationContextImpl.java
deleted file mode 100644
index 9ca50dc..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/GroupValidationContextImpl.java
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.BeanValidationContext;
-import org.apache.bval.jsr.groups.Group;
-import org.apache.bval.jsr.groups.Groups;
-import org.apache.bval.jsr.resolver.CachingTraversableResolver;
-import org.apache.bval.jsr.util.NodeImpl;
-import org.apache.bval.jsr.util.PathImpl;
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.MetaProperty;
-import org.apache.bval.util.AccessStrategy;
-
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorFactory;
-import javax.validation.ElementKind;
-import javax.validation.MessageInterpolator;
-import javax.validation.ParameterNameProvider;
-import javax.validation.Path;
-import javax.validation.TraversableResolver;
-import javax.validation.ValidationException;
-import javax.validation.metadata.ConstraintDescriptor;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Description: instance per validation process, not thread-safe<br/>
- */
-final class GroupValidationContextImpl<T> extends BeanValidationContext<ConstraintValidationListener<T>>
-    implements GroupValidationContext<T>, MessageInterpolator.Context {
-
-    private final MessageInterpolator messageResolver;
-    private final PathImpl path;
-    private final MetaBean rootMetaBean;
-    private final ParameterNameProvider parameterNameProvider;
-
-    /**
-     * the groups in the sequence of validation to take place
-     */
-    private Groups groups;
-    /**
-     * the current group during the validation process
-     */
-    private Group currentGroup;
-
-    private Class<?> currentOwner;
-
-    /**
-     * contains the validation constraints that have already been processed
-     * during this validation routine (as part of a previous group match)
-     */
-    private HashSet<ConstraintValidatorIdentity> validatedConstraints = new HashSet<ConstraintValidatorIdentity>();
-
-    private ConstraintValidation<?> constraintValidation;
-    private final TraversableResolver traversableResolver;
-    private final ConstraintValidatorFactory constraintValidatorFactory;
-
-    private Object[] parameters;
-    private Object returnValue;
-    private Method method;
-    private Constructor<?> constructor;
-
-    /**
-     * Create a new GroupValidationContextImpl instance.
-     *
-     * @param listener
-     * @param aMessageResolver
-     * @param traversableResolver
-     * @param parameterNameProvider
-     * @param rootMetaBean
-     */
-    public GroupValidationContextImpl(ConstraintValidationListener<T> listener, MessageInterpolator aMessageResolver,
-        TraversableResolver traversableResolver, ParameterNameProvider parameterNameProvider,
-        ConstraintValidatorFactory constraintValidatorFactory, MetaBean rootMetaBean) {
-        super(listener, new HashMap<GraphBeanIdentity, Set<PathImpl>>());
-        this.messageResolver = aMessageResolver;
-        this.constraintValidatorFactory = constraintValidatorFactory;
-        this.traversableResolver = CachingTraversableResolver.cacheFor(traversableResolver);
-        this.parameterNameProvider = parameterNameProvider;
-        this.rootMetaBean = rootMetaBean;
-        this.path = PathImpl.create();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setCurrentIndex(Integer index) {
-        NodeImpl leaf = path.getLeafNode();
-        if (leaf.getName() == null) {
-            leaf.setIndex(index);
-        } else {
-            path.addNode(NodeImpl.atIndex(index));
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setCurrentKey(Object key) {
-        NodeImpl leaf = path.getLeafNode();
-        if (leaf.getName() == null) {
-            leaf.setKey(key);
-        } else {
-            path.addNode(NodeImpl.atKey(key));
-        }
-    }
-
-    @Override
-    public void setKind(final ElementKind type) {
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void moveDown(MetaProperty prop, AccessStrategy access) {
-        moveDown(prop.getName());
-        super.moveDown(prop, access);
-    }
-
-    @Override
-    public void moveDown(final String prop) {
-        path.addProperty(prop);
-    }
-
-    @Override
-    public void moveDown(final Path.Node node) {
-        path.addNode(node);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void moveUp(Object bean, MetaBean metaBean) {
-        NodeImpl leaf = path.getLeafNode();
-        if (leaf.isInIterable() && leaf.getName() != null) {
-            leaf.setName(null);
-        } else {
-            path.removeLeafNode();
-        }
-        super.moveUp(bean, metaBean); // call super!
-    }
-
-    /**
-     * {@inheritDoc} Here, state equates to bean identity + group.
-     */
-    @SuppressWarnings("unchecked")
-    @Override
-    public boolean collectValidated() {
-
-        // Combination of bean+group+owner (owner is currently ignored)
-        GraphBeanIdentity gbi = new GraphBeanIdentity(getBean(), getCurrentGroup().getGroup(), getCurrentOwner());
-
-        Set<PathImpl> validatedPathsForGBI = (Set<PathImpl>) validatedObjects.get(gbi);
-        if (validatedPathsForGBI == null) {
-            validatedPathsForGBI = new HashSet<PathImpl>();
-            validatedObjects.put(gbi, validatedPathsForGBI);
-        }
-
-        // If any of the paths is a subpath of the current path, there is a
-        // circular dependency, so return false
-        for (PathImpl validatedPath : validatedPathsForGBI) {
-            if (path.isSubPathOf(validatedPath)) {
-                return false;
-            }
-        }
-
-        // Else, add the currentPath to the set of validatedPaths
-        validatedPathsForGBI.add(PathImpl.copy(path));
-        return true;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean collectValidated(ConstraintValidator<?, ?> constraint) {
-        ConstraintValidatorIdentity cvi = new ConstraintValidatorIdentity(getBean(), getPropertyPath(), constraint);
-        return this.validatedConstraints.add(cvi);
-    }
-
-    /**
-     * Reset the validated constraints.
-     */
-    public void resetValidatedConstraints() {
-        validatedConstraints.clear();
-    }
-
-    /**
-     * {@inheritDoc} If an associated object is validated, add the association
-     * field or JavaBeans property name and a dot ('.') as a prefix to the
-     * previous rules. uses prop[index] in property path for elements in
-     * to-many-relationships.
-     * 
-     * @return the path in dot notation
-     */
-    @Override
-    public PathImpl getPropertyPath() {
-        PathImpl currentPath = PathImpl.copy(path);
-        if (getMetaProperty() != null) {
-            currentPath.addProperty(getMetaProperty().getName());
-        }
-        return currentPath;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public MetaBean getRootMetaBean() {
-        return rootMetaBean;
-    }
-
-    /**
-     * Set the Groups.
-     * 
-     * @param groups
-     */
-    public void setGroups(Groups groups) {
-        this.groups = groups;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Groups getGroups() {
-        return groups;
-    }
-
-    @Override
-    public void setCurrentGroups(final Groups g) {
-        groups = g;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Group getCurrentGroup() {
-        return currentGroup;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setCurrentGroup(Group currentGroup) {
-        this.currentGroup = currentGroup;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setConstraintValidation(ConstraintValidation<?> constraint) {
-        constraintValidation = constraint;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ConstraintValidation<?> getConstraintValidation() {
-        return constraintValidation;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ConstraintDescriptor<?> getConstraintDescriptor() {
-        return constraintValidation;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Object getValidatedValue() {
-        if (getMetaProperty() != null) {
-            return getPropertyValue(constraintValidation.getAccess());
-        } else {
-            return getBean();
-        }
-    }
-
-    @Override
-    public <U> U unwrap(Class<U> type) {
-        if (type.isInstance(this)) {
-            return type.cast(this);
-        }
-        throw new ValidationException("Type " + type + " not supported");
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public MessageInterpolator getMessageResolver() {
-        return messageResolver;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public TraversableResolver getTraversableResolver() {
-        return traversableResolver;
-    }
-
-    @Override
-    public ConstraintValidatorFactory getConstraintValidatorFactory() {
-        return constraintValidatorFactory;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Class<?> getCurrentOwner() {
-        return this.currentOwner;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setCurrentOwner(Class<?> currentOwner) {
-        this.currentOwner = currentOwner;
-    }
-
-    @Override
-    public ElementKind getElementKind() {
-        return path.getLeafNode().getKind();
-    }
-
-    @Override
-    public Object getReturnValue() {
-        return returnValue;
-    }
-
-    @Override
-    public Object[] getParameters() {
-        return parameters;
-    }
-
-    @Override
-    public void setParameters(final Object[] parameters) {
-        this.parameters = parameters;
-    }
-
-    @Override
-    public void setReturnValue(final Object returnValue) {
-        this.returnValue = returnValue;
-    }
-
-    @Override
-    public ParameterNameProvider getParameterNameProvider() {
-        return parameterNameProvider;
-    }
-
-    @Override
-    public void setMethod(final Method method) {
-        this.method = method;
-    }
-
-    @Override
-    public Method getMethod() {
-        return method;
-    }
-
-    @Override
-    public Constructor<?> getConstructor() {
-        return constructor;
-    }
-
-    @Override
-    public void setConstructor(final Constructor<?> constructor) {
-        this.constructor = constructor;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/IncompatiblePropertyValueException.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/IncompatiblePropertyValueException.java b/bval-jsr/src/main/java/org/apache/bval/jsr/IncompatiblePropertyValueException.java
deleted file mode 100644
index e94a101..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/IncompatiblePropertyValueException.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.    
- */
-package org.apache.bval.jsr;
-
-import javax.validation.ValidationException;
-
-/**
- * Internal exception thrown when trying to validate a value for a property for which it is not assignment-compatible.
- * 
- * @version $Rev: 1031833 $ $Date: 2010-11-05 16:53:03 -0500 (Fri, 05 Nov 2010) $
- * 
- * @author Matt Benson
- */
-public class IncompatiblePropertyValueException extends ValidationException {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * Create a new {@link IncompatiblePropertyValueException} instance.
-     * 
-     * @param message
-     */
-    public IncompatiblePropertyValueException(String message) {
-        super(message);
-    }
-
-    /**
-     * Create a new IncompatiblePropertyValueException instance.
-     */
-    public IncompatiblePropertyValueException() {
-        super();
-    }
-
-    /**
-     * Create a new IncompatiblePropertyValueException instance.
-     * 
-     * @param message
-     * @param cause
-     */
-    public IncompatiblePropertyValueException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    /**
-     * Create a new IncompatiblePropertyValueException instance.
-     * 
-     * @param cause
-     */
-    public IncompatiblePropertyValueException(Throwable cause) {
-        super(cause);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/InvocableElementDescriptor.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/InvocableElementDescriptor.java b/bval-jsr/src/main/java/org/apache/bval/jsr/InvocableElementDescriptor.java
deleted file mode 100644
index f54b553..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/InvocableElementDescriptor.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.Validation;
-
-import javax.validation.metadata.ConstraintDescriptor;
-import javax.validation.metadata.CrossParameterDescriptor;
-import javax.validation.metadata.ElementDescriptor;
-import javax.validation.metadata.ParameterDescriptor;
-import javax.validation.metadata.ReturnValueDescriptor;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
-
-public class InvocableElementDescriptor extends ElementDescriptorImpl implements ProcedureDescriptor {
-    private static final CopyOnWriteArraySet<ConstraintValidation<?>> NO_CONSTRAINTS =
-        new CopyOnWriteArraySet<ConstraintValidation<?>>();
-
-    private ReturnValueDescriptor returnValueDescriptor;
-    private CrossParameterDescriptor crossParameterDescriptor;
-    private final List<ParameterDescriptor> parameterDescriptors = new ArrayList<ParameterDescriptor>();
-
-    protected InvocableElementDescriptor(final MetaBean metaBean, final Class<?> elementClass,
-        final Validation[] validations) {
-        super(metaBean, elementClass, validations);
-    }
-
-    protected InvocableElementDescriptor(final Class<?> elementClass, final Validation[] validations) {
-        super(elementClass, validations);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public List<ParameterDescriptor> getParameterDescriptors() {
-        // index aligned
-        return parameterDescriptors;
-    }
-
-    public void setReturnValueDescriptor(final ReturnValueDescriptor returnValueDescriptor) {
-        this.returnValueDescriptor = returnValueDescriptor;
-    }
-
-    public CrossParameterDescriptor getCrossParameterDescriptor() {
-        return crossParameterDescriptor;
-    }
-
-    public void setCrossParameterDescriptor(final CrossParameterDescriptor crossParameterDescriptor) {
-        this.crossParameterDescriptor = crossParameterDescriptor;
-    }
-
-    /**
-     * Add the specified validations to this {@link org.apache.bval.jsr.MethodDescriptorImpl}.
-     * @param validations
-     */
-    void addValidations(Collection<ConstraintValidation<?>> validations) {
-        getMutableConstraintDescriptors().addAll(validations);
-    }
-
-    protected boolean hasConstrainedParameters() {
-        for (final ParameterDescriptor pd : getParameterDescriptors()) {
-            if (pd.isCascaded() || !pd.getConstraintDescriptors().isEmpty()) {
-                return true;
-            }
-        }
-        return getCrossParameterDescriptor().hasConstraints();
-    }
-
-    public ReturnValueDescriptor getReturnValueDescriptor() {
-        return returnValueDescriptor;
-    }
-
-    protected boolean hasConstrainedReturnValue() {
-        return getReturnValueDescriptor().isCascaded()
-            || !getReturnValueDescriptor().getConstraintDescriptors().isEmpty();
-    }
-
-    @Override
-    public ElementDescriptor.ConstraintFinder findConstraints() {
-        return new ConstraintFinderImpl(metaBean, NO_CONSTRAINTS);
-    }
-
-    @Override
-    public Set<ConstraintDescriptor<?>> getConstraintDescriptors() {
-        return Set.class.cast(NO_CONSTRAINTS);
-    }
-}


[2/6] bval git commit: clean up no-longer-used code from JSR module

Posted by mb...@apache.org.
http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/JsrFeatures.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/JsrFeatures.java b/bval-jsr/src/main/java/org/apache/bval/jsr/JsrFeatures.java
deleted file mode 100644
index 91687f9..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/JsrFeatures.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.    
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.model.Features;
-
-/**
- * Description: Contains MetaBean feature keys of additional features used in the implementation
- * of JSR303<br/>
- *
- * @see org.apache.bval.model.FeaturesCapable
- * @see org.apache.bval.model.Features
- */
-public interface JsrFeatures {
-    interface Method extends Features.Property {
-        String MethodDescriptor = "MethodDescriptor";
-    }
-
-    interface Constructor extends Features.Property {
-        String ConstructorDescriptor = "ConstructorDescriptor";
-    }
-
-    /**
-     * JSR303 Property features
-     */
-    interface Property extends Features.Property {
-        /** INFO: cached PropertyDescriptorImpl of the property */
-        String PropertyDescriptor = "PropertyDescriptor";
-        /**
-         * INFO: Class[] with the groups to validate a REF_CASCADE
-         */
-        String REF_GROUPS = "refGroups";
-
-        // Collection<Annotation>
-        String ANNOTATIONS_TO_PROCESS = "annotationToProcess";
-    }
-
-    /**
-     * JSR303 bean features
-     */
-    interface Bean extends Features.Bean {
-        /**
-         * INFO: List of Group(Class) for {@link javax.validation.GroupSequence#value()}
-         * (redefined default group)
-         **/
-        String GROUP_SEQUENCE = "GroupSequence";
-
-        /**
-         * INFO: cached BeanDescriptorImpl of the bean
-         */
-        String BEAN_DESCRIPTOR = "BeanDescriptor";
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/JsrMetaBeanFactory.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/JsrMetaBeanFactory.java b/bval-jsr/src/main/java/org/apache/bval/jsr/JsrMetaBeanFactory.java
deleted file mode 100644
index 97eece1..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/JsrMetaBeanFactory.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.MetaBeanFactory;
-import org.apache.bval.jsr.groups.Group;
-import org.apache.bval.jsr.util.ClassHelper;
-import org.apache.bval.jsr.xml.MetaConstraint;
-import org.apache.bval.model.Features.Property;
-import org.apache.bval.model.Meta;
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.MetaConstructor;
-import org.apache.bval.model.MetaMethod;
-import org.apache.bval.model.MetaParameter;
-import org.apache.bval.model.MetaProperty;
-import org.apache.bval.util.AccessStrategy;
-import org.apache.bval.util.FieldAccess;
-import org.apache.bval.util.MethodAccess;
-import org.apache.bval.util.reflection.Reflection;
-import org.apache.commons.weaver.privilizer.Privilizing;
-import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
-
-import javax.validation.ConstraintDeclarationException;
-import javax.validation.GroupDefinitionException;
-import javax.validation.GroupSequence;
-import javax.validation.groups.ConvertGroup;
-import javax.validation.groups.Default;
-
-import java.lang.annotation.Annotation;
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Description: process the class annotations for JSR303 constraint validations to build the MetaBean with information
- * from annotations and JSR303 constraint mappings (defined in xml)<br/>
- */
-@Privilizing(@CallTo(Reflection.class))
-public class JsrMetaBeanFactory implements MetaBeanFactory {
-    /** Shared log instance */
-    // of dubious utility as it's static :/
-    protected static final Logger log = Logger.getLogger(JsrMetaBeanFactory.class.getName());
-
-    /** {@link javax.validation.ValidatorFactory} used */
-    protected final ApacheValidatorFactory factory;
-
-    /**
-     * {@link AnnotationProcessor} used.
-     */
-    protected AnnotationProcessor annotationProcessor;
-
-    /**
-     * Create a new Jsr303MetaBeanFactory instance.
-     * 
-     * @param factory the validator factory.
-     */
-    public JsrMetaBeanFactory(ApacheValidatorFactory factory) {
-        this.factory = factory;
-        this.annotationProcessor = new AnnotationProcessor(factory);
-    }
-
-    /**
-     * {@inheritDoc} Add the validation features to the metabean that come from JSR303 annotations in the beanClass.
-     */
-    @Override
-    public void buildMetaBean(MetaBean metabean) {
-        try {
-            final Class<?> beanClass = metabean.getBeanClass();
-            processGroupSequence(beanClass, metabean);
-
-            // process class, superclasses and interfaces
-            final List<Class<?>> classSequence =
-                ClassHelper.fillFullClassHierarchyAsList(new ArrayList<Class<?>>(), beanClass);
-
-            // start with superclasses and go down the hierarchy so that
-            // the child classes are processed last to have the chance to
-            // overwrite some declarations
-            // of their superclasses and that they see what they inherit at the
-            // time of processing
-            for (int i = classSequence.size() - 1; i >= 0; i--) {
-                Class<?> eachClass = classSequence.get(i);
-                processClass(eachClass, metabean);
-                processGroupSequence(eachClass, metabean, "{GroupSequence:" + eachClass.getCanonicalName() + "}");
-            }
-
-        } catch (IllegalAccessException e) {
-            throw new IllegalArgumentException(e);
-        } catch (InvocationTargetException e) {
-            throw new IllegalArgumentException(e.getTargetException());
-        }
-    }
-
-    /**
-     * Process class annotations, field and method annotations.
-     * 
-     * @param beanClass
-     * @param metabean
-     * @throws IllegalAccessException
-     * @throws InvocationTargetException
-     */
-    private void processClass(Class<?> beanClass, MetaBean metabean)
-        throws IllegalAccessException, InvocationTargetException {
-
-        // if NOT ignore class level annotations
-        if (!factory.getAnnotationIgnores().isIgnoreAnnotations(beanClass)) {
-            annotationProcessor.processAnnotations(null, beanClass, beanClass, null,
-                new AppendValidationToMeta(metabean));
-        }
-
-        final Collection<String> missingValid = new ArrayList<String>();
-
-        final Field[] fields = Reflection.getDeclaredFields(beanClass);
-        for (final Field field : fields) {
-            MetaProperty metaProperty = metabean.getProperty(field.getName());
-            // create a property for those fields for which there is not yet a
-            // MetaProperty
-            if (!factory.getAnnotationIgnores().isIgnoreAnnotations(field)) {
-                AccessStrategy access = new FieldAccess(field);
-                boolean create = metaProperty == null;
-                if (create) {
-                    metaProperty = addMetaProperty(metabean, access);
-                }
-                if (!annotationProcessor.processAnnotations(metaProperty, beanClass, field, access,
-                    new AppendValidationToMeta(metaProperty)) && create) {
-                    metabean.putProperty(metaProperty.getName(), null);
-                }
-
-                if (field.getAnnotation(ConvertGroup.class) != null) {
-                    missingValid.add(field.getName());
-                }
-            }
-        }
-        final Method[] methods = Reflection.getDeclaredMethods(beanClass);
-        for (final Method method : methods) {
-            if (method.isSynthetic() || method.isBridge()) {
-                continue;
-            }
-            String propName = null;
-            if (method.getParameterTypes().length == 0) {
-                propName = MethodAccess.getPropertyName(method);
-            }
-            if (propName != null) {
-                if (!factory.getAnnotationIgnores().isIgnoreAnnotations(method)) {
-                    AccessStrategy access = new MethodAccess(propName, method);
-                    MetaProperty metaProperty = metabean.getProperty(propName);
-                    boolean create = metaProperty == null;
-                    // create a property for those methods for which there is
-                    // not yet a MetaProperty
-                    if (create) {
-                        metaProperty = addMetaProperty(metabean, access);
-                    }
-                    if (!annotationProcessor.processAnnotations(metaProperty, beanClass, method, access,
-                        new AppendValidationToMeta(metaProperty)) && create) {
-                        metabean.putProperty(propName, null);
-                    }
-                }
-            }
-        }
-
-        addXmlConstraints(beanClass, metabean);
-
-        for (final String name : missingValid) {
-            final MetaProperty metaProperty = metabean.getProperty(name);
-            if (metaProperty != null && metaProperty.getFeature(Property.REF_CASCADE) == null) {
-                throw new ConstraintDeclarationException("@ConvertGroup needs @Valid");
-            }
-        }
-        missingValid.clear();
-    }
-
-    /**
-     * Add cascade validation and constraints from xml mappings
-     * 
-     * @param beanClass
-     * @param metabean
-     * @throws IllegalAccessException
-     * @throws InvocationTargetException
-     */
-    private void addXmlConstraints(Class<?> beanClass, MetaBean metabean)
-        throws IllegalAccessException, InvocationTargetException {
-        for (final MetaConstraint<?, ? extends Annotation> metaConstraint : factory.getMetaConstraints(beanClass)) {
-            Meta meta;
-            AccessStrategy access = metaConstraint.getAccessStrategy();
-            boolean create = false;
-            if (access == null) { // class level
-                meta = null;
-            } else if (access.getElementType() == ElementType.METHOD
-                && !metaConstraint.getMember().getName().startsWith("get")) { // TODO: better getter test
-                final Method method = Method.class.cast(metaConstraint.getMember());
-                meta = metabean.getMethod(method);
-                final MetaMethod metaMethod;
-                if (meta == null) {
-                    meta = new MetaMethod(metabean, method);
-                    metaMethod = MetaMethod.class.cast(meta);
-                    metabean.addMethod(method, metaMethod);
-                } else {
-                    metaMethod = MetaMethod.class.cast(meta);
-                }
-                final Integer index = metaConstraint.getIndex();
-                if (index != null && index >= 0) {
-                    MetaParameter param = metaMethod.getParameter(index);
-                    if (param == null) {
-                        param = new MetaParameter(metaMethod, index);
-                        metaMethod.addParameter(index, param);
-                    }
-                    param.addAnnotation(metaConstraint.getAnnotation());
-                } else {
-                    metaMethod.addAnnotation(metaConstraint.getAnnotation());
-                }
-                continue;
-            } else if (access.getElementType() == ElementType.CONSTRUCTOR) {
-                final Constructor<?> constructor = Constructor.class.cast(metaConstraint.getMember());
-                meta = metabean.getConstructor(constructor);
-                final MetaConstructor metaConstructor;
-                if (meta == null) {
-                    meta = new MetaConstructor(metabean, constructor);
-                    metaConstructor = MetaConstructor.class.cast(meta);
-                    metabean.addConstructor(constructor, metaConstructor);
-                } else {
-                    metaConstructor = MetaConstructor.class.cast(meta);
-                }
-                final Integer index = metaConstraint.getIndex();
-                if (index != null && index >= 0) {
-                    MetaParameter param = metaConstructor.getParameter(index);
-                    if (param == null) {
-                        param = new MetaParameter(metaConstructor, index);
-                        metaConstructor.addParameter(index, param);
-                    }
-                    param.addAnnotation(metaConstraint.getAnnotation());
-                } else {
-                    metaConstructor.addAnnotation(metaConstraint.getAnnotation());
-                }
-                continue;
-            } else { // property level
-                meta = metabean.getProperty(access.getPropertyName());
-                create = meta == null;
-                if (create) {
-                    meta = addMetaProperty(metabean, access);
-                }
-            }
-            if (!annotationProcessor.processAnnotation(metaConstraint.getAnnotation(), meta, beanClass,
-                metaConstraint.getAccessStrategy(), new AppendValidationToMeta(meta == null ? metabean : meta), false)
-                && create) {
-                metabean.putProperty(access.getPropertyName(), null);
-            }
-        }
-        for (final AccessStrategy access : factory.getValidAccesses(beanClass)) {
-            if (access.getElementType() == ElementType.PARAMETER) {
-                continue;
-            }
-
-            MetaProperty metaProperty = metabean.getProperty(access.getPropertyName());
-            boolean create = metaProperty == null;
-            if (create) {
-                metaProperty = addMetaProperty(metabean, access);
-            }
-            if (!annotationProcessor.addAccessStrategy(metaProperty, access) && create) {
-                metabean.putProperty(access.getPropertyName(), null);
-            }
-        }
-    }
-
-    private void processGroupSequence(Class<?> beanClass, MetaBean metabean) {
-        processGroupSequence(beanClass, metabean, JsrFeatures.Bean.GROUP_SEQUENCE);
-    }
-
-    private void processGroupSequence(Class<?> beanClass, MetaBean metabean, String key) {
-        GroupSequence annotation = beanClass.getAnnotation(GroupSequence.class);
-        List<Group> groupSeq = metabean.getFeature(key);
-        if (groupSeq == null) {
-            groupSeq =
-                metabean.initFeature(key, new ArrayList<Group>(annotation == null ? 1 : annotation.value().length));
-        }
-        Class<?>[] groupClasses = factory.getDefaultSequence(beanClass);
-        if (groupClasses == null || groupClasses.length == 0) {
-            if (annotation == null) {
-                groupSeq.add(Group.DEFAULT);
-                return;
-            } else {
-                groupClasses = annotation.value();
-            }
-        }
-        boolean containsDefault = false;
-        for (final Class<?> groupClass : groupClasses) {
-            if (groupClass.getName().equals(beanClass.getName())) {
-                groupSeq.add(Group.DEFAULT);
-                containsDefault = true;
-            } else if (groupClass.getName().equals(Default.class.getName())) {
-                throw new GroupDefinitionException("'Default.class' must not appear in @GroupSequence! Use '"
-                    + beanClass.getSimpleName() + ".class' instead.");
-            } else {
-                groupSeq.add(new Group(groupClass));
-            }
-        }
-        if (!containsDefault) {
-            throw new GroupDefinitionException("Redefined default group sequence must contain " + beanClass.getName());
-        }
-        log.log(Level.FINEST,
-            String.format("Default group sequence for bean %s is: %s", beanClass.getName(), groupSeq));
-    }
-
-    /**
-     * Add a {@link MetaProperty} to a {@link MetaBean}.
-     * @param parentMetaBean
-     * @param access
-     * @return the created {@link MetaProperty}
-     */
-    public static MetaProperty addMetaProperty(MetaBean parentMetaBean, AccessStrategy access) {
-        final MetaProperty result = new MetaProperty();
-        final String name = access.getPropertyName();
-        result.setName(name);
-        result.setType(access.getJavaType());
-        parentMetaBean.putProperty(name, result);
-        return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/MethodDescriptor.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/MethodDescriptor.java b/bval-jsr/src/main/java/org/apache/bval/jsr/MethodDescriptor.java
deleted file mode 100644
index 99bc31d..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/MethodDescriptor.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.bval.jsr;
-
-import javax.validation.metadata.ElementDescriptor;
-import javax.validation.metadata.ParameterDescriptor;
-import java.util.List;
-
-/**
- * Description: This class will disappear when such
- * functionality is part of the JSR303 specification.<br/>
- */
-public interface MethodDescriptor extends ElementDescriptor {
-    /**
-     * Get the {@link javax.validation.metadata.ParameterDescriptor}s for this {@link org.apache.bval.jsr.MethodDescriptor}.
-     * @return {@link java.util.List} of {@link javax.validation.metadata.ParameterDescriptor}
-     */
-    List<ParameterDescriptor> getParameterDescriptors(); //index aligned
-
-    /**
-     * Learn whether the referenced method should be validated.
-     * @return boolean
-     */
-    boolean isCascaded();
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/MethodDescriptorImpl.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/MethodDescriptorImpl.java b/bval-jsr/src/main/java/org/apache/bval/jsr/MethodDescriptorImpl.java
deleted file mode 100644
index f9b0247..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/MethodDescriptorImpl.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.MetaMethod;
-import org.apache.bval.model.Validation;
-
-import java.lang.reflect.Method;
-
-/**
- * Description: {@link MethodDescriptor} implementation.<br/>
- */
-public class MethodDescriptorImpl extends InvocableElementDescriptor
-    implements javax.validation.metadata.MethodDescriptor, ProcedureDescriptor {
-    private static final Validation[] EMPTY_VALIDATION = new Validation[0];
-
-    private final String name;
-
-    protected MethodDescriptorImpl(final MetaBean metaBean, final Validation[] validations, final Method method) {
-        super(metaBean, method.getReturnType(), validations);
-        name = method.getName();
-    }
-
-    public MethodDescriptorImpl(final MetaBean bean, final MetaMethod metaMethod) {
-        super(bean, metaMethod.getMethod().getReturnType(), EMPTY_VALIDATION);
-        setCascaded(false);
-        this.name = metaMethod.getMethod().getName();
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public boolean hasConstrainedParameters() {
-        return super.hasConstrainedParameters();
-    }
-
-    @Override
-    public boolean hasConstrainedReturnValue() {
-        return super.hasConstrainedReturnValue();
-    }
-
-    @Override
-    public boolean hasConstraints() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ParameterAccess.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ParameterAccess.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ParameterAccess.java
deleted file mode 100644
index a9c16bb..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ParameterAccess.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.bval.jsr;
-
-import org.apache.bval.util.AccessStrategy;
-
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Type;
-
-/**
- * Implementation of {@link org.apache.bval.util.AccessStrategy} for method parameters.
- *
- * @author Carlos Vara
- */
-public class ParameterAccess extends AccessStrategy {
-
-    private Type paramType;
-    private int paramIdx;
-
-    /**
-     * Create a new ParameterAccess instance.
-     * @param paramType
-     * @param paramIdx
-     */
-    public ParameterAccess(Type paramType, int paramIdx) {
-        this.paramType = paramType;
-        this.paramIdx = paramIdx;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Object get(Object instance) {
-        throw new UnsupportedOperationException("Obtaining a parameter value not yet implemented");
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ElementType getElementType() {
-        return ElementType.PARAMETER;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Type getJavaType() {
-        return this.paramType;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getPropertyName() {
-        return "" + paramIdx;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o)
-            return true;
-        if (o == null || getClass() != o.getClass())
-            return false;
-
-        final ParameterAccess that = (ParameterAccess) o;
-        return paramIdx == that.paramIdx && paramType.equals(that.paramType);
-    }
-
-    @Override
-    public int hashCode() {
-        int result = paramType.hashCode();
-        result = 31 * result + paramIdx;
-        return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ParameterDescriptorImpl.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ParameterDescriptorImpl.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ParameterDescriptorImpl.java
deleted file mode 100644
index 65f3ecc..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ParameterDescriptorImpl.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.jsr.groups.Group;
-import org.apache.bval.jsr.groups.GroupConversionDescriptorImpl;
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.Validation;
-
-import javax.validation.metadata.ContainerElementTypeDescriptor;
-import javax.validation.metadata.GroupConversionDescriptor;
-import javax.validation.metadata.ParameterDescriptor;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
-
-/**
- * Description: {@link javax.validation.metadata.ParameterDescriptor} implementation.<br/>
- */
-public class ParameterDescriptorImpl extends ElementDescriptorImpl implements ParameterDescriptor {
-    private final Set<GroupConversionDescriptor> groupConversions =
-        new CopyOnWriteArraySet<GroupConversionDescriptor>();
-    private final String name;
-    private int index;
-
-    /**
-     * Create a new ParameterDescriptorImpl instance.
-     * @param metaBean
-     * @param validations
-     */
-    public ParameterDescriptorImpl(MetaBean metaBean, Validation[] validations, String name) {
-        super(metaBean, metaBean.getBeanClass(), validations);
-        this.name = name;
-    }
-
-    /**
-     * Create a new ParameterDescriptorImpl instance.
-     * @param elementClass
-     * @param validations
-     */
-    public ParameterDescriptorImpl(Class<?> elementClass, Validation[] validations, String name) {
-        super(elementClass, validations);
-        this.name = name;
-    }
-
-    @Override
-    public Set<GroupConversionDescriptor> getGroupConversions() {
-        return groupConversions;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int getIndex() {
-        return index;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Set the index of the referenced parameter.
-     * @param index
-     */
-    public void setIndex(int index) {
-        this.index = index;
-    }
-
-    @Override
-    public void addGroupMapping(final Group from, final Group to) {
-        groupConversions.add(new GroupConversionDescriptorImpl(from, to));
-        super.addGroupMapping(from, to);
-    }
-
-    @Override
-    public Set<ContainerElementTypeDescriptor> getConstrainedContainerElementTypes() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ParametersAccess.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ParametersAccess.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ParametersAccess.java
deleted file mode 100644
index 2490dbc..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ParametersAccess.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.util.AccessStrategy;
-
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Type;
-
-public class ParametersAccess extends AccessStrategy {
-    @Override
-    public Object get(final Object instance) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public ElementType getElementType() {
-        return ElementType.PARAMETER;
-    }
-
-    @Override
-    public Type getJavaType() {
-        return Object[].class;
-    }
-
-    @Override
-    public String getPropertyName() {
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ProcedureDescriptor.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ProcedureDescriptor.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ProcedureDescriptor.java
deleted file mode 100644
index d85c703..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ProcedureDescriptor.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.jsr.groups.Group;
-import org.apache.bval.model.MetaBean;
-
-import javax.validation.metadata.ParameterDescriptor;
-import java.util.List;
-
-/**
- * Description: superinterface of {@link javax.validation.metadata.ConstructorDescriptor} and {@link org.apache.bval.jsr.MethodDescriptor}.<br/>
- */
-public interface ProcedureDescriptor {
-    /**
-     * Get the owning metabean.
-     * @return MetaBean
-     */
-    MetaBean getMetaBean();
-
-    /**
-     * Set whether this procedure should be validated.
-     * @param b
-     */
-    void setCascaded(boolean b);
-
-    /**
-     * Get the parameter descriptors of this procedure.
-     * @return {@link java.util.List} of {@link javax.validation.metadata.ParameterDescriptor}
-     */
-    List<ParameterDescriptor> getParameterDescriptors();
-
-    void addGroupMapping(Group from, Group to);
-
-    Group mapGroup(Group current);
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/PropertyDescriptorImpl.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/PropertyDescriptorImpl.java b/bval-jsr/src/main/java/org/apache/bval/jsr/PropertyDescriptorImpl.java
deleted file mode 100644
index 03cf5de..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/PropertyDescriptorImpl.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.model.Features;
-import org.apache.bval.model.MetaProperty;
-
-import java.util.Set;
-
-import javax.validation.metadata.ContainerElementTypeDescriptor;
-import javax.validation.metadata.PropertyDescriptor;
-
-/**
- * Description: {@link PropertyDescriptor} implementation.<br/>
- *
- * TODO: use it instead of MetaProperty!
- */
-class PropertyDescriptorImpl extends ElementDescriptorImpl implements PropertyDescriptor {
-    private String propertyPath;
-
-    /**
-     * Create a new PropertyDescriptorImpl instance.
-     * 
-     * @param property
-     */
-    PropertyDescriptorImpl(MetaProperty property) {
-        super(property.getParentMetaBean(), property.getTypeClass(), property.getValidations());
-        setCascaded(property.getMetaBean() != null || property.getFeature(Features.Property.REF_CASCADE) != null);
-        setPropertyPath(property.getName());
-    }
-
-    /**
-     * Set the referenced property path.
-     * 
-     * @param propertyPath
-     */
-    public void setPropertyPath(String propertyPath) {
-        this.propertyPath = propertyPath;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getPropertyName() {
-        return propertyPath;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
-        return "PropertyDescriptorImpl{" + "returnType=" + elementClass + ", propertyPath='" + propertyPath + '\''
-            + '}';
-    }
-
-    @Override
-    public Set<ContainerElementTypeDescriptor> getConstrainedContainerElementTypes() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ReturnAccess.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ReturnAccess.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ReturnAccess.java
deleted file mode 100644
index b973b3f..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ReturnAccess.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.bval.jsr;
-
-import org.apache.bval.util.AccessStrategy;
-
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Type;
-
-/**
- * Implementation of {@link org.apache.bval.util.AccessStrategy} for method return values.
- *
- * @author Carlos Vara
- */
-public class ReturnAccess extends AccessStrategy {
-
-    private Type returnType;
-
-    /**
-     * Create a new ReturnAccess instance.
-     * @param returnType
-     */
-    public ReturnAccess(Type returnType) {
-        this.returnType = returnType;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Object get(Object instance) {
-        throw new UnsupportedOperationException("Obtaining a method return value not yet implemented");
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ElementType getElementType() {
-        return ElementType.METHOD;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Type getJavaType() {
-        return this.returnType;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getPropertyName() {
-        return "Return value";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ReturnValueDescriptorImpl.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ReturnValueDescriptorImpl.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ReturnValueDescriptorImpl.java
deleted file mode 100644
index a6faa9b..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ReturnValueDescriptorImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.model.MetaBean;
-
-import javax.validation.metadata.ContainerElementTypeDescriptor;
-import javax.validation.metadata.ReturnValueDescriptor;
-import java.util.Collection;
-import java.util.Set;
-
-public class ReturnValueDescriptorImpl extends ElementDescriptorImpl implements ReturnValueDescriptor {
-    public ReturnValueDescriptorImpl(final MetaBean metaBean, Class<?> returnType,
-        final Collection<ConstraintValidation<?>> list, boolean cascaded) {
-        super(metaBean, returnType, list.toArray(new ConstraintValidation<?>[list.size()]));
-        setCascaded(cascaded);
-    }
-
-    @Override
-    public boolean hasConstraints() {
-        return false;
-    }
-
-    @Override
-    public Set<ContainerElementTypeDescriptor> getConstrainedContainerElementTypes() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/UnknownPropertyException.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/UnknownPropertyException.java b/bval-jsr/src/main/java/org/apache/bval/jsr/UnknownPropertyException.java
deleted file mode 100644
index c771050..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/UnknownPropertyException.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.    
- */
-package org.apache.bval.jsr;
-
-import javax.validation.ValidationException;
-
-/**
- * Internal exception thrown when trying to access a property that doesn't exist
- * in a bean.
- * 
- * @version $Rev: 1166451 $ $Date: 2011-09-08 00:32:26 +0200 (jeu., 08 sept. 2011) $
- * 
- * @author Carlos Vara
- */
-public class UnknownPropertyException extends ValidationException {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * Create a new UnknownPropertyException instance.
-     * @param message
-     */
-    public UnknownPropertyException(String message) {
-        super(message);
-    }
-
-    /**
-     * Create a new UnknownPropertyException instance.
-     */
-    public UnknownPropertyException() {
-        super();
-    }
-
-    /**
-     * Create a new UnknownPropertyException instance.
-     * @param message
-     * @param cause
-     */
-    public UnknownPropertyException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    /**
-     * Create a new UnknownPropertyException instance.
-     * @param cause
-     */
-    public UnknownPropertyException(Throwable cause) {
-        super(cause);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/CascadableContainerD.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/CascadableContainerD.java b/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/CascadableContainerD.java
index 8e6410a..7404278 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/CascadableContainerD.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/CascadableContainerD.java
@@ -29,6 +29,7 @@ import javax.validation.metadata.ContainerElementTypeDescriptor;
 import javax.validation.metadata.GroupConversionDescriptor;
 
 import org.apache.bval.jsr.GraphContext;
+import org.apache.bval.jsr.groups.GroupConversion;
 import org.apache.bval.jsr.util.ToUnmodifiable;
 import org.apache.bval.util.Validate;
 import org.apache.bval.util.reflection.TypeUtils;

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/DescriptorManager.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/DescriptorManager.java b/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/DescriptorManager.java
index e90527e..01a1b5c 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/DescriptorManager.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/DescriptorManager.java
@@ -62,6 +62,10 @@ public class DescriptorManager {
         return Optional.ofNullable(beanDescriptors.putIfAbsent(beanClass, beanD)).orElse(beanD);
     }
 
+    public void clear() {
+        beanDescriptors.clear();
+    }
+
     private MetadataBuilder.ForBean builder(Class<?> beanClass) {
         final MetadataBuilder.ForBean primaryBuilder =
             new HierarchyBuilder(reflectionBuilder::forBean).forBean(beanClass);

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/GroupConversion.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/GroupConversion.java b/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/GroupConversion.java
deleted file mode 100644
index 9ef724e..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/GroupConversion.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.bval.jsr.descriptor;
-
-import java.util.Objects;
-import java.util.Optional;
-
-import javax.validation.metadata.GroupConversionDescriptor;
-
-import org.apache.bval.util.Lazy;
-import org.apache.bval.util.LazyInt;
-import org.apache.bval.util.Validate;
-
-public class GroupConversion implements GroupConversionDescriptor {
-    public static class Builder {
-        private final Class<?> from;
-
-        private Builder(Class<?> from) {
-            this.from = from;
-        }
-
-        public GroupConversion to(Class<?> to) {
-            return new GroupConversion(from, to);
-        }
-    }
-
-    public static Builder from(Class<?> from) {
-        return new Builder(from);
-    }
-
-    private final Class<?> from;
-    private final Class<?> to;
-    private final LazyInt hashCode;
-    private final Lazy<String> toString;
-
-    private GroupConversion(Class<?> from, Class<?> to) {
-        super();
-        this.from = Validate.notNull(from, "from");
-        this.to = Validate.notNull(to, "to");
-        this.hashCode = new LazyInt(() -> Objects.hash(this.from, this.to));
-        this.toString = new Lazy<>(
-            () -> String.format("%s from %s to %s", GroupConversion.class.getSimpleName(), this.from, this.to));
-    }
-
-    @Override
-    public Class<?> getFrom() {
-        return from;
-    }
-
-    @Override
-    public Class<?> getTo() {
-        return to;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        return obj == this
-            || Optional.ofNullable(obj).filter(GroupConversion.class::isInstance).map(GroupConversion.class::cast)
-                .filter(gc -> Objects.equals(from, gc.from) && Objects.equals(to, gc.to)).isPresent();
-    }
-
-    @Override
-    public int hashCode() {
-        return hashCode.getAsInt();
-    }
-
-    @Override
-    public String toString() {
-        return toString.get();
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/MetadataReader.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/MetadataReader.java b/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/MetadataReader.java
index ba49ed4..6f00495 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/MetadataReader.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/descriptor/MetadataReader.java
@@ -47,6 +47,7 @@ import javax.validation.metadata.PropertyDescriptor;
 import javax.validation.metadata.Scope;
 
 import org.apache.bval.jsr.ApacheValidatorFactory;
+import org.apache.bval.jsr.groups.GroupConversion;
 import org.apache.bval.jsr.metadata.ContainerElementKey;
 import org.apache.bval.jsr.metadata.EmptyBuilder;
 import org.apache.bval.jsr.metadata.MetadataBuilder;

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/groups/GroupConversion.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/groups/GroupConversion.java b/bval-jsr/src/main/java/org/apache/bval/jsr/groups/GroupConversion.java
new file mode 100644
index 0000000..68babdf
--- /dev/null
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/groups/GroupConversion.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.bval.jsr.groups;
+
+import java.util.Objects;
+import java.util.Optional;
+
+import javax.validation.metadata.GroupConversionDescriptor;
+
+import org.apache.bval.util.Lazy;
+import org.apache.bval.util.LazyInt;
+import org.apache.bval.util.Validate;
+
+public class GroupConversion implements GroupConversionDescriptor {
+    public static class Builder {
+        private final Class<?> from;
+
+        private Builder(Class<?> from) {
+            this.from = from;
+        }
+
+        public GroupConversion to(Class<?> to) {
+            return new GroupConversion(from, to);
+        }
+    }
+
+    public static Builder from(Class<?> from) {
+        return new Builder(from);
+    }
+
+    private final Class<?> from;
+    private final Class<?> to;
+    private final LazyInt hashCode;
+    private final Lazy<String> toString;
+
+    private GroupConversion(Class<?> from, Class<?> to) {
+        super();
+        this.from = Validate.notNull(from, "from");
+        this.to = Validate.notNull(to, "to");
+        this.hashCode = new LazyInt(() -> Objects.hash(this.from, this.to));
+        this.toString = new Lazy<>(
+            () -> String.format("%s from %s to %s", GroupConversion.class.getSimpleName(), this.from, this.to));
+    }
+
+    @Override
+    public Class<?> getFrom() {
+        return from;
+    }
+
+    @Override
+    public Class<?> getTo() {
+        return to;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        return obj == this
+            || Optional.ofNullable(obj).filter(GroupConversion.class::isInstance).map(GroupConversion.class::cast)
+                .filter(gc -> Objects.equals(from, gc.from) && Objects.equals(to, gc.to)).isPresent();
+    }
+
+    @Override
+    public int hashCode() {
+        return hashCode.getAsInt();
+    }
+
+    @Override
+    public String toString() {
+        return toString.get();
+    }
+}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/groups/GroupConversionDescriptorImpl.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/groups/GroupConversionDescriptorImpl.java b/bval-jsr/src/main/java/org/apache/bval/jsr/groups/GroupConversionDescriptorImpl.java
deleted file mode 100644
index 6d45ced..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/groups/GroupConversionDescriptorImpl.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.bval.jsr.groups;
-
-import javax.validation.ConstraintDeclarationException;
-import javax.validation.GroupSequence;
-import javax.validation.metadata.GroupConversionDescriptor;
-
-public class GroupConversionDescriptorImpl implements GroupConversionDescriptor {
-    private final Class<?> to;
-    private final Class<?> from;
-
-    public GroupConversionDescriptorImpl(final Group from, final Group to) {
-        this.from = from.getGroup();
-        if (this.from.isAnnotationPresent(GroupSequence.class)) {
-            throw new ConstraintDeclarationException("from() can't get a group sequence");
-        }
-        this.to = to.getGroup();
-    }
-
-    @Override
-    public Class<?> getFrom() {
-        return from;
-    }
-
-    @Override
-    public Class<?> getTo() {
-        return to;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/CompositeBuilder.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/CompositeBuilder.java b/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/CompositeBuilder.java
index 54ff0f8..0090790 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/CompositeBuilder.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/CompositeBuilder.java
@@ -38,7 +38,7 @@ import java.util.stream.Stream;
 
 import javax.validation.metadata.Scope;
 
-import org.apache.bval.jsr.descriptor.GroupConversion;
+import org.apache.bval.jsr.groups.GroupConversion;
 import org.apache.bval.jsr.util.ToUnmodifiable;
 import org.apache.bval.util.Validate;
 

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/DualBuilder.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/DualBuilder.java b/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/DualBuilder.java
index 269d953..9524889 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/DualBuilder.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/DualBuilder.java
@@ -36,7 +36,7 @@ import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 import java.util.stream.Stream;
 
-import org.apache.bval.jsr.descriptor.GroupConversion;
+import org.apache.bval.jsr.groups.GroupConversion;
 import org.apache.bval.jsr.util.ToUnmodifiable;
 import org.apache.bval.util.Validate;
 

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/EmptyBuilder.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/EmptyBuilder.java b/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/EmptyBuilder.java
index c95f6d7..7321784 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/EmptyBuilder.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/EmptyBuilder.java
@@ -30,7 +30,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.bval.jsr.descriptor.GroupConversion;
+import org.apache.bval.jsr.groups.GroupConversion;
 import org.apache.bval.util.Lazy;
 import org.apache.bval.util.ObjectUtils;
 import org.apache.bval.util.Validate;

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/MetadataBuilder.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/MetadataBuilder.java b/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/MetadataBuilder.java
index 7dbdcbc..ac6cc1a 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/MetadataBuilder.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/MetadataBuilder.java
@@ -31,7 +31,7 @@ import java.util.Set;
 
 import javax.validation.metadata.Scope;
 
-import org.apache.bval.jsr.descriptor.GroupConversion;
+import org.apache.bval.jsr.groups.GroupConversion;
 
 /**
  * Common interface for populating the Bean Validation descriptors from various sources. Most implementations should

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/ReflectionBuilder.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/ReflectionBuilder.java b/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/ReflectionBuilder.java
index 12f62da..ea1a9bf 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/ReflectionBuilder.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/ReflectionBuilder.java
@@ -48,7 +48,7 @@ import javax.validation.groups.ConvertGroup;
 
 import org.apache.bval.jsr.ApacheValidatorFactory;
 import org.apache.bval.jsr.ConstraintAnnotationAttributes;
-import org.apache.bval.jsr.descriptor.GroupConversion;
+import org.apache.bval.jsr.groups.GroupConversion;
 import org.apache.bval.jsr.util.AnnotationsManager;
 import org.apache.bval.jsr.util.Methods;
 import org.apache.bval.jsr.util.ToUnmodifiable;

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/XmlBuilder.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/XmlBuilder.java b/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/XmlBuilder.java
index bd71ccc..aef162d 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/XmlBuilder.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/metadata/XmlBuilder.java
@@ -48,7 +48,7 @@ import javax.validation.ValidationException;
 import javax.xml.bind.JAXBElement;
 
 import org.apache.bval.jsr.ConstraintAnnotationAttributes;
-import org.apache.bval.jsr.descriptor.GroupConversion;
+import org.apache.bval.jsr.groups.GroupConversion;
 import org.apache.bval.jsr.util.AnnotationsManager;
 import org.apache.bval.jsr.util.ToUnmodifiable;
 import org.apache.bval.jsr.xml.AnnotationProxyBuilder;

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/util/ClassHelper.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/util/ClassHelper.java b/bval-jsr/src/main/java/org/apache/bval/jsr/util/ClassHelper.java
deleted file mode 100644
index 73c82a6..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/util/ClassHelper.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.    
- */
-package org.apache.bval.jsr.util;
-
-import java.io.Serializable;
-import java.security.AccessController;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Common operations on classes that do not require an {@link AccessController}.
- * 
- * @author Carlos Vara
- */
-public class ClassHelper {
-    private static final Set<Class<?>> IGNORED_TYPES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(null,Object.class,Serializable.class,Cloneable.class)));
-
-    private ClassHelper() {
-        // No instances please
-    }
-
-    /**
-     * Fill the list with the full class/interface hierarchy of the given class.
-     * List is ordered from the most to less specific.
-     *
-     * @param allClasses
-     *            The current list of classes in the hierarchy.
-     * @param clazz
-     */
-    public static List<Class<?>> fillFullClassHierarchyAsList(List<Class<?>> allClasses, Class<?> clazz) {
-        if (IGNORED_TYPES.contains(clazz) || allClasses.contains(clazz)) {
-            return allClasses;
-        }
-        allClasses.add(clazz);
-        fillFullClassHierarchyAsList(allClasses, clazz.getSuperclass());
-        for (Class<?> subClass : clazz.getInterfaces()) {
-            fillFullClassHierarchyAsList(allClasses, subClass);
-        }
-        return allClasses;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/util/ContainerElementNodeBuilderCustomizableContextImpl.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/util/ContainerElementNodeBuilderCustomizableContextImpl.java b/bval-jsr/src/main/java/org/apache/bval/jsr/util/ContainerElementNodeBuilderCustomizableContextImpl.java
index 13c3365..7459fdc 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/util/ContainerElementNodeBuilderCustomizableContextImpl.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/util/ContainerElementNodeBuilderCustomizableContextImpl.java
@@ -74,5 +74,4 @@ public class ContainerElementNodeBuilderCustomizableContextImpl
         context.addError(template, path);
         return context;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/util/EnumerationConverter.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/util/EnumerationConverter.java b/bval-jsr/src/main/java/org/apache/bval/jsr/util/EnumerationConverter.java
deleted file mode 100644
index 159fc43..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/util/EnumerationConverter.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.bval.jsr.util;
-
-import org.apache.commons.beanutils.Converter;
-
-/**
- * A {@code org.apache.commons.beanutils.Converter} implementation to handle
- * Enumeration type.
- */
-@Deprecated
-public final class EnumerationConverter implements Converter {
-
-    /**
-     * The static converter instance.
-     */
-    private static final EnumerationConverter INSTANCE = new EnumerationConverter();
-
-    /**
-     * Returns this converter instance.
-     *
-     * @return this converter instance.
-     */
-    public static EnumerationConverter getInstance() {
-        return INSTANCE;
-    }
-
-    /**
-     * This class can't be instantiated.
-     */
-    private EnumerationConverter() {
-        // do nothing
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public Object convert(Class type, Object value) {
-        if (!type.isEnum()) {
-            throw new RuntimeException("Only enum types supported in this version!");
-        }
-
-        if (value == null) {
-            throw new RuntimeException("Null values not supported in this version!");
-        }
-
-        if (String.class != value.getClass()) {
-            throw new RuntimeException("Only java.lang.String values supported in this version!");
-        }
-
-        String stringValue = (String) value;
-
-        final Class<Enum> enumClass = type;
-        return Enum.valueOf(enumClass, stringValue);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/util/NodeBuilderDefinedContextImpl.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/util/NodeBuilderDefinedContextImpl.java b/bval-jsr/src/main/java/org/apache/bval/jsr/util/NodeBuilderDefinedContextImpl.java
index f695e84..5a20e08 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/util/NodeBuilderDefinedContextImpl.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/util/NodeBuilderDefinedContextImpl.java
@@ -28,7 +28,7 @@ import org.apache.bval.jsr.job.ConstraintValidatorContextImpl;
  */
 public final class NodeBuilderDefinedContextImpl
     implements ConstraintValidatorContext.ConstraintViolationBuilder.NodeBuilderDefinedContext {
-    private final ConstraintValidatorContextImpl context;
+    private final ConstraintValidatorContextImpl<?> context;
     private final String template;
     private final PathImpl path;
 
@@ -38,7 +38,7 @@ public final class NodeBuilderDefinedContextImpl
      * @param template
      * @param path
      */
-    public NodeBuilderDefinedContextImpl(ConstraintValidatorContextImpl contextImpl, String template, PathImpl path) {
+    public NodeBuilderDefinedContextImpl(ConstraintValidatorContextImpl<?> contextImpl, String template, PathImpl path) {
         this.context = contextImpl;
         this.template = template;
         this.path = path;

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/util/ValidationContextTraversal.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/util/ValidationContextTraversal.java b/bval-jsr/src/main/java/org/apache/bval/jsr/util/ValidationContextTraversal.java
deleted file mode 100644
index f6e19c0..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/util/ValidationContextTraversal.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.bval.jsr.util;
-
-import org.apache.bval.DynamicMetaBean;
-import org.apache.bval.jsr.JsrMetaBeanFactory;
-import org.apache.bval.jsr.UnknownPropertyException;
-import org.apache.bval.jsr.util.PathNavigation.CallbackProcedure;
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.MetaProperty;
-import org.apache.bval.model.ValidationContext;
-import org.apache.bval.util.AccessStrategy;
-import org.apache.bval.util.IndexedAccess;
-import org.apache.bval.util.KeyedAccess;
-import org.apache.bval.util.PropertyAccess;
-import org.apache.bval.util.ObjectUtils;
-import org.apache.bval.util.reflection.TypeUtils;
-
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Type;
-
-/**
- * {@link ValidationContext} traversal {@link CallbackProcedure}.
- * 
- * @version $Rev: 1137074 $ $Date: 2011-06-17 18:20:30 -0500 (Fri, 17 Jun 2011) $
- */
-public class ValidationContextTraversal extends CallbackProcedure {
-    private static class NullSafePropertyAccess extends AccessStrategy {
-        private final PropertyAccess wrapped;
-
-        /**
-         * Create a new NullSafePropertyAccess instance.
-         * 
-         * @param clazz
-         * @param propertyName
-         */
-        public NullSafePropertyAccess(Class<?> clazz, String propertyName) {
-            wrapped = PropertyAccess.getInstance(clazz, propertyName);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public Object get(Object bean) {
-            return bean == null ? null : wrapped.get(bean);
-        }
-
-        @Override
-        public ElementType getElementType() {
-            return wrapped.getElementType();
-        }
-
-        @Override
-        public Type getJavaType() {
-            return wrapped.getJavaType();
-        }
-
-        @Override
-        public String getPropertyName() {
-            return wrapped.getPropertyName();
-        }
-    }
-
-    private final ValidationContext<?> validationContext;
-    private Type type;
-    private Class<?> rawType;
-
-    /**
-     * Create a new {@link ValidationContextTraversal} instance.
-     * 
-     * @param validationContext
-     */
-    public ValidationContextTraversal(ValidationContext<?> validationContext) {
-        this.validationContext = validationContext;
-        init();
-    }
-
-    /**
-     * Initialize from {@link ValidationContext}.
-     */
-    public void init() {
-        this.rawType = validationContext.getMetaBean().getBeanClass();
-        this.type = this.rawType;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleIndexOrKey(String token) {
-        moveDownIfNecessary();
-
-        AccessStrategy access;
-        if (IndexedAccess.getJavaElementType(type) != null) {
-            try {
-                Integer index = token == null ? null : Integer.valueOf(token);
-                access = new IndexedAccess(type, index);
-                validationContext.setCurrentIndex(index);
-            } catch (NumberFormatException e) {
-                throw new UnknownPropertyException(String.format("Cannot parse %s as an array/iterable index", token),
-                    e);
-            }
-        } else if (KeyedAccess.getJavaElementType(type) != null) {
-            access = new KeyedAccess(type, token);
-            validationContext.setCurrentKey(token);
-        } else {
-            throw new UnknownPropertyException(String.format("Cannot determine index/key type for %s", type));
-        }
-        Object value = validationContext.getBean();
-        Object child = value == null ? null : access.get(value);
-        setType(child == null ? access.getJavaType() : child.getClass());
-        validationContext.setBean(child,
-            validationContext.getMetaBean().resolveMetaBean(child == null ? rawType : child));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleProperty(String token) {
-        moveDownIfNecessary();
-
-        MetaBean metaBean = validationContext.getMetaBean();
-
-        if (metaBean instanceof DynamicMetaBean) {
-            metaBean = metaBean.resolveMetaBean(ObjectUtils.defaultIfNull(validationContext.getBean(), rawType));
-            validationContext.setMetaBean(metaBean);
-        }
-        MetaProperty mp = metaBean.getProperty(token);
-        if (mp == null) {
-            // TODO this could indicate a property hosted on a superclass; should we shunt the context traversal down a path based on that type?
-
-            PropertyAccess access = PropertyAccess.getInstance(rawType, token);
-            if (access.isKnown()) {
-                // add heretofore unknown, but valid, property on the fly:
-                mp = JsrMetaBeanFactory.addMetaProperty(metaBean, access);
-            } else {
-                throw new UnknownPropertyException("unknown property '" + token + "' in " + metaBean.getId());
-            }
-        }
-        validationContext.setMetaProperty(mp);
-        setType(mp.getType());
-    }
-
-    /**
-     * If we currently have a property, navigate the context such that the property becomes the bean, in preparation for
-     * another property.
-     */
-    public void moveDownIfNecessary() {
-        MetaProperty mp = validationContext.getMetaProperty();
-        if (mp != null) {
-            if (mp.getMetaBean() == null) {
-                throw new UnknownPropertyException(
-                    String.format("Property %s.%s is not cascaded", mp.getParentMetaBean().getId(), mp.getName()));
-            }
-            validationContext.moveDown(mp,
-                new NullSafePropertyAccess(validationContext.getMetaBean().getBeanClass(), mp.getName()));
-        }
-    }
-
-    /**
-     * Set the type of the expression processed thus far.
-     * 
-     * @param type
-     */
-    protected void setType(Type type) {
-        this.rawType = TypeUtils.getRawType(type, this.type);
-        this.type = type;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void handleGenericInIterable() {
-        throw new UnsupportedOperationException("Cannot navigate a ValidationContext to []");
-    }
-
-    /**
-     * @return the type
-     */
-    public Type getType() {
-        return type;
-    }
-
-    /**
-     * @return the rawType
-     */
-    public Class<?> getRawType() {
-        return rawType;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void complete() {
-        super.complete();
-        if (validationContext.getMetaProperty() != null) {
-            return;
-        }
-        if (validationContext.getMetaBean() instanceof DynamicMetaBean) {
-            validationContext.setMetaBean(validationContext.getMetaBean()
-                .resolveMetaBean(ObjectUtils.defaultIfNull(validationContext.getBean(), rawType)));
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/xml/AnnotationIgnores.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/xml/AnnotationIgnores.java b/bval-jsr/src/main/java/org/apache/bval/jsr/xml/AnnotationIgnores.java
deleted file mode 100644
index 3ac39c4..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/xml/AnnotationIgnores.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.bval.jsr.xml;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Description: This class instantiated during the parsing of the XML configuration
- * data and keeps track of the annotations which should be ignored.<br/>
- */
-public final class AnnotationIgnores {
-
-    private static final Logger log = Logger.getLogger(AnnotationIgnores.class.getName());
-
-    /**
-     * Keeps track whether the 'ignore-annotations' flag is set on bean level in the
-     * xml configuration. 
-     * If 'ignore-annotations' is not specified: default = true
-     */
-    private final Map<Class<?>, Boolean> ignoreAnnotationDefaults = new HashMap<Class<?>, Boolean>();
-
-    /**
-     * Keeps track of explicitly excluded members (fields and properties) for a given class.
-     * If a member appears in
-     * the list mapped to a given class 'ignore-annotations' was explicitly set to
-     * <code>true</code> in the configuration
-     * for this class.
-     */
-    private final Map<Class<?>, Map<Member, Boolean>> ignoreAnnotationOnMember =
-        new HashMap<Class<?>, Map<Member, Boolean>>();
-
-    private final Map<Class<?>, Boolean> ignoreAnnotationOnClass = new HashMap<Class<?>, Boolean>();
-
-    private final Map<Class<?>, Map<Member, Map<Integer, Boolean>>> ignoreAnnotationOnParameter =
-        new HashMap<Class<?>, Map<Member, Map<Integer, Boolean>>>();
-    private final Map<Member, Boolean> ignoreAnnotationOnReturn = new HashMap<Member, Boolean>();
-    private final Map<Member, Boolean> ignoreAnnotationOnCrossParameter = new HashMap<Member, Boolean>();
-
-    /**
-     * Record the ignore state for a particular annotation type.
-     * @param clazz
-     * @param b, default true if null
-     */
-    public void setDefaultIgnoreAnnotation(Class<?> clazz, Boolean b) {
-        ignoreAnnotationDefaults.put(clazz, b == null || b.booleanValue());
-    }
-
-    /**
-     * Learn whether the specified annotation type should be ignored.
-     * @param clazz
-     * @return boolean
-     */
-    public boolean getDefaultIgnoreAnnotation(Class<?> clazz) {
-        return ignoreAnnotationDefaults.containsKey(clazz) && ignoreAnnotationDefaults.get(clazz);
-    }
-
-    /**
-     * Ignore annotations on a particular {@link Member} of a class.
-     * @param member
-     */
-    public void setIgnoreAnnotationsOnMember(Member member, boolean value) {
-        Class<?> beanClass = member.getDeclaringClass();
-        Map<Member, Boolean> memberList = ignoreAnnotationOnMember.get(beanClass);
-        if (memberList == null) {
-            memberList = new HashMap<Member, Boolean>();
-            ignoreAnnotationOnMember.put(beanClass, memberList);
-        }
-        memberList.put(member, value);
-    }
-
-    /**
-     * Learn whether annotations should be ignored on a particular {@link Member} of a class.
-     * @param member
-     * @return boolean
-     */
-    public boolean isIgnoreAnnotations(final Member member) {
-        final Class<?> clazz = member.getDeclaringClass();
-        final Map<Member, Boolean> ignoreAnnotationForMembers = ignoreAnnotationOnMember.get(clazz);
-        if (ignoreAnnotationForMembers != null && ignoreAnnotationForMembers.containsKey(member)) {
-            final boolean value = ignoreAnnotationForMembers.get(member);
-            if (value) {
-                logMessage(member, clazz);
-            }
-            return value;
-        }
-
-        final boolean ignoreAnnotation = getDefaultIgnoreAnnotation(clazz);
-        if (ignoreAnnotation) {
-            logMessage(member, clazz);
-        }
-        return ignoreAnnotation;
-    }
-
-    public void setIgnoreAnnotationsOnParameter(final Member method, final int i, final boolean value) {
-        final Class<?> beanClass = method.getDeclaringClass();
-        Map<Member, Map<Integer, Boolean>> memberList = ignoreAnnotationOnParameter.get(beanClass);
-        if (memberList == null) {
-            memberList = new HashMap<Member, Map<Integer, Boolean>>();
-            ignoreAnnotationOnParameter.put(beanClass, memberList);
-        }
-        Map<Integer, Boolean> indexes = memberList.get(method);
-        if (indexes == null) {
-            indexes = new HashMap<Integer, Boolean>();
-            memberList.put(method, indexes);
-        }
-        indexes.put(i, value);
-    }
-
-    public boolean isIgnoreAnnotationOnParameter(final Member m, final int i) {
-        final Map<Member, Map<Integer, Boolean>> members = ignoreAnnotationOnParameter.get(m.getDeclaringClass());
-        if (members != null) {
-            final Map<Integer, Boolean> indexes = members.get(m);
-            if (indexes != null && indexes.containsKey(i)) {
-                return indexes.get(i);
-            }
-        }
-        return false;
-    }
-
-    private void logMessage(Member member, Class<?> clazz) {
-        String type;
-        if (member instanceof Field) {
-            type = "Field";
-        } else {
-            type = "Property";
-        }
-        log.log(Level.FINEST, String.format("%s level annotations are getting ignored for %s.%s", type, clazz.getName(),
-            member.getName()));
-    }
-
-    /**
-     * Record the ignore state of a particular class. 
-     * @param clazz
-     * @param b
-     */
-    public void setIgnoreAnnotationsOnClass(Class<?> clazz, boolean b) {
-        ignoreAnnotationOnClass.put(clazz, b);
-    }
-
-    /**
-     * Learn whether annotations should be ignored for a given class.
-     * @param clazz to check
-     * @return boolean
-     */
-    public boolean isIgnoreAnnotations(Class<?> clazz) {
-        boolean ignoreAnnotation;
-        if (ignoreAnnotationOnClass.containsKey(clazz)) {
-            ignoreAnnotation = ignoreAnnotationOnClass.get(clazz);
-        } else {
-            ignoreAnnotation = getDefaultIgnoreAnnotation(clazz);
-        }
-        if (ignoreAnnotation) {
-            log.log(Level.FINEST, String.format("Class level annotation are getting ignored for %s", clazz.getName()));
-        }
-        return ignoreAnnotation;
-    }
-
-    public void setIgnoreAnnotationOnReturn(final Member method, final boolean value) {
-        ignoreAnnotationOnReturn.put(method, value);
-    }
-
-    public boolean isIgnoreAnnotationOnReturn(final Member m) {
-        final Boolean value = ignoreAnnotationOnReturn.get(m);
-        if (value != null) {
-            return value;
-        }
-        return false;
-    }
-
-    public void setIgnoreAnnotationOnCrossParameter(final Member method, final boolean value) {
-        ignoreAnnotationOnCrossParameter.put(method, value);
-    }
-
-    public boolean isIgnoreAnnotationOnCrossParameter(final Member m) {
-        final Boolean value = ignoreAnnotationOnCrossParameter.get(m);
-        if (value != null) {
-            return value;
-        }
-        return false;
-    }
-}


[4/6] bval git commit: clean up no-longer-used code from JSR module

Posted by mb...@apache.org.
http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ClassValidator.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ClassValidator.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ClassValidator.java
deleted file mode 100644
index d7b4640..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ClassValidator.java
+++ /dev/null
@@ -1,1292 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.    
- */
-package org.apache.bval.jsr;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.validation.ConstraintDeclarationException;
-import javax.validation.ConstraintDefinitionException;
-import javax.validation.ConstraintTarget;
-import javax.validation.ConstraintViolation;
-import javax.validation.ElementKind;
-import javax.validation.ValidationException;
-import javax.validation.executable.ExecutableValidator;
-import javax.validation.groups.Default;
-import javax.validation.metadata.BeanDescriptor;
-import javax.validation.metadata.ConstraintDescriptor;
-import javax.validation.metadata.ElementDescriptor;
-import javax.validation.metadata.ParameterDescriptor;
-import javax.validation.metadata.PropertyDescriptor;
-
-import org.apache.bval.DynamicMetaBean;
-import org.apache.bval.MetaBeanFinder;
-import org.apache.bval.jsr.groups.Group;
-import org.apache.bval.jsr.groups.Groups;
-import org.apache.bval.jsr.groups.GroupsComputer;
-import org.apache.bval.jsr.util.ClassHelper;
-import org.apache.bval.jsr.util.NodeImpl;
-import org.apache.bval.jsr.util.PathImpl;
-import org.apache.bval.jsr.util.PathNavigation;
-import org.apache.bval.jsr.util.Proxies;
-import org.apache.bval.jsr.util.ValidationContextTraversal;
-import org.apache.bval.model.Features;
-import org.apache.bval.model.FeaturesCapable;
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.MetaProperty;
-import org.apache.bval.model.Validation;
-import org.apache.bval.util.AccessStrategy;
-import org.apache.bval.util.ValidationHelper;
-import org.apache.bval.util.ObjectUtils;
-import org.apache.bval.util.reflection.Reflection;
-import org.apache.bval.util.reflection.TypeUtils;
-import org.apache.commons.weaver.privilizer.Privilizing;
-import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
-
-/**
- * Objects of this class are able to validate bean instances (and the associated object graphs).
- * <p/>
- * Implementation is thread-safe.
- * <p/>
- * API class
- *
- * @version $Rev: 1514672 $ $Date: 2013-08-16 14:15:12 +0200 (ven., 16 août 2013) $
- * 
- * @author Roman Stumm
- * @author Carlos Vara
- */
-@Privilizing(@CallTo(Reflection.class))
-public class ClassValidator implements CascadingPropertyValidator, ExecutableValidator {
-    private static final Object VALIDATE_PROPERTY = new Object() {
-        @Override
-        public String toString() {
-            return "VALIDATE_PROPERTY";
-        }
-    };
-
-    /**
-     * {@link ApacheFactoryContext} used
-     */
-    protected final ApacheFactoryContext factoryContext;
-
-    /**
-     * {@link GroupsComputer} used
-     */
-    protected final GroupsComputer groupsComputer = new GroupsComputer();
-
-    private final MetaBeanFinder metaBeanFinder;
-
-    /**
-     * Create a new ClassValidator instance.
-     *
-     * @param factoryContext
-     */
-    public ClassValidator(ApacheFactoryContext factoryContext) {
-        this.factoryContext = factoryContext;
-        metaBeanFinder = factoryContext.getMetaBeanFinder();
-    }
-
-    // Validator implementation
-    // --------------------------------------------------
-
-    /**
-     * {@inheritDoc} Validates all constraints on <code>object</code>.
-     *
-     * @param object object to validate
-     * @param groups group or list of groups targeted for validation (default to
-     *               {@link javax.validation.groups.Default})
-     * @return constraint violations or an empty Set if none
-     * @throws IllegalArgumentException if object is null or if null is passed to the varargs groups
-     * @throws ValidationException      if a non recoverable error happens during the validation
-     *                                  process
-     */
-    @Override
-    @SuppressWarnings("unchecked")
-    public <T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups) {
-        notNull("validated object", object);
-        checkGroups(groups);
-
-        try {
-            final Class<T> objectClass = (Class<T>) object.getClass();
-            final MetaBean objectMetaBean = metaBeanFinder.findForClass(objectClass);
-            final GroupValidationContext<T> context = createContext(objectMetaBean, object, objectClass, groups);
-            return validateBeanWithGroups(context, context.getGroups());
-        } catch (final RuntimeException ex) {
-            throw unrecoverableValidationError(ex, object);
-        }
-    }
-
-    private <T> Set<ConstraintViolation<T>> validateBeanWithGroups(final GroupValidationContext<T> context,
-        final Groups sequence) {
-        final ConstraintValidationListener<T> result = context.getListener();
-
-        // 1. process groups
-        for (final Group current : sequence.getGroups()) {
-            context.setCurrentGroup(current);
-            validateBeanNet(context);
-        }
-
-        // 2. process sequences
-        for (final List<Group> eachSeq : sequence.getSequences()) {
-            for (final Group current : eachSeq) {
-                context.setCurrentGroup(current);
-                validateBeanNet(context);
-                // if one of the group process in the sequence leads to one
-                // or more validation failure,
-                // the groups following in the sequence must not be
-                // processed
-                if (!result.isEmpty()) {
-                    break;
-                }
-            }
-            if (!result.isEmpty()) {
-                break;
-            }
-        }
-        return result.getConstraintViolations();
-    }
-
-    /**
-     * {@inheritDoc} Validates all constraints placed on the property of <code>object</code> named
-     * <code>propertyName</code>.
-     *
-     * @param object       object to validate
-     * @param propertyName property to validate (ie field and getter constraints). Nested
-     *                     properties may be referenced (e.g. prop[2].subpropA.subpropB)
-     * @param groups       group or list of groups targeted for validation (default to
-     *                     {@link javax.validation.groups.Default})
-     * @return constraint violations or an empty Set if none
-     * @throws IllegalArgumentException if <code>object</code> is null, if <code>propertyName</code>
-     *                                  null, empty or not a valid object property or if null is
-     *                                  passed to the varargs groups
-     * @throws ValidationException      if a non recoverable error happens during the validation
-     *                                  process
-     */
-    @Override
-    public <T> Set<ConstraintViolation<T>> validateProperty(T object, String propertyName, Class<?>... groups) {
-        return validateProperty(object, propertyName, false, groups);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <T> Set<ConstraintViolation<T>> validateProperty(T object, String propertyName, boolean cascade,
-        Class<?>... groups) {
-        notNull("validated object", object);
-
-        @SuppressWarnings("unchecked")
-        final Set<ConstraintViolation<T>> result =
-            validateValueImpl((Class<T>) object.getClass(), object, propertyName, VALIDATE_PROPERTY, cascade, groups);
-        return result;
-    }
-
-    /**
-     * {@inheritDoc} Validates all constraints placed on the property named <code>propertyName</code> of the class
-     * <code>beanType</code> would the property value be <code>value</code>
-     * <p/>
-     * <code>ConstraintViolation</code> objects return null for {@link ConstraintViolation#getRootBean()} and
-     * {@link ConstraintViolation#getLeafBean()}
-     *
-     * @param beanType     the bean type
-     * @param propertyName property to validate
-     * @param value        property value to validate
-     * @param groups       group or list of groups targeted for validation (default to
-     *                     {@link javax.validation.groups.Default})
-     * @return constraint violations or an empty Set if none
-     * @throws IllegalArgumentException if <code>beanType</code> is null, if
-     *                                  <code>propertyName</code> null, empty or not a valid object
-     *                                  property or if null is passed to the varargs groups
-     * @throws ValidationException      if a non recoverable error happens during the validation
-     *                                  process
-     */
-    @Override
-    public <T> Set<ConstraintViolation<T>> validateValue(Class<T> beanType, String propertyName, Object value,
-        Class<?>... groups) {
-        return validateValue(beanType, propertyName, value, false, groups);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <T> Set<ConstraintViolation<T>> validateValue(Class<T> beanType, String propertyName, Object value,
-        boolean cascade, Class<?>... groups) {
-        return validateValueImpl(notNull("bean type", beanType), null, propertyName, value, cascade, groups);
-    }
-
-    /**
-     * {@inheritDoc} Return the descriptor object describing bean constraints. The returned object (and associated
-     * objects including <code>ConstraintDescriptor<code>s) are immutable.
-     *
-     * @param clazz class or interface type evaluated
-     * @return the bean descriptor for the specified class.
-     * @throws IllegalArgumentException if clazz is null
-     * @throws ValidationException      if a non recoverable error happens during the metadata
-     *                                  discovery or if some constraints are invalid.
-     */
-    @Override
-    public BeanDescriptor getConstraintsForClass(final Class<?> clazz) {
-        notNull("class", clazz);
-        try {
-            final MetaBean metaBean = metaBeanFinder.findForClass(clazz); // don't throw an exception because of a missing validator here
-            BeanDescriptorImpl edesc = metaBean.getFeature(JsrFeatures.Bean.BEAN_DESCRIPTOR);
-            if (edesc == null) {
-                edesc = metaBean.initFeature(JsrFeatures.Bean.BEAN_DESCRIPTOR, createBeanDescriptor(metaBean));
-            }
-            return edesc;
-        } catch (final ConstraintDefinitionException definitionEx) {
-            throw definitionEx;
-        } catch (final ConstraintDeclarationException declarationEx) {
-            throw declarationEx;
-        } catch (final RuntimeException ex) {
-            throw new ValidationException("error retrieving constraints for " + clazz, ex);
-        }
-    }
-
-    /**
-     * {@inheritDoc} Return an instance of the specified type allowing access to provider-specific APIs. If the Bean
-     * Validation provider implementation does not support the specified class, <code>ValidationException</code> is
-     * thrown.
-     *
-     * @param type the class of the object to be returned.
-     * @return an instance of the specified class
-     * @throws ValidationException if the provider does not support the call.
-     */
-    @Override
-    public <T> T unwrap(Class<T> type) {
-        // FIXME 2011-03-27 jw:
-        // This code is unsecure.
-        // It should allow only a fixed set of classes.
-        // Can't fix this because don't know which classes this method should support.
-
-        if (type.isAssignableFrom(getClass())) {
-            @SuppressWarnings("unchecked")
-            final T result = (T) this;
-            return result;
-        }
-        if (!(type.isInterface() || Modifier.isAbstract(type.getModifiers()))) {
-            return newInstance(type);
-        }
-        try {
-            final Class<?> cls = Reflection.toClass(type.getName() + "Impl");
-            if (type.isAssignableFrom(cls)) {
-                @SuppressWarnings("unchecked")
-                final Class<? extends T> implClass = (Class<? extends T>) cls;
-                return newInstance(implClass);
-            }
-        } catch (ClassNotFoundException e) {
-        }
-        throw new ValidationException("Type " + type + " not supported");
-    }
-
-    @Override
-    public ExecutableValidator forExecutables() {
-        return this;
-    }
-
-    private <T> T newInstance(final Class<T> cls) {
-        final Constructor<T> cons = Reflection.getDeclaredConstructor(cls, ApacheFactoryContext.class);
-        if (cons == null) {
-            throw new ValidationException("Cannot instantiate " + cls);
-        }
-        final boolean mustUnset = Reflection.setAccessible(cons, true);
-        try {
-            return cons.newInstance(factoryContext);
-        } catch (final Exception ex) {
-            throw new ValidationException("Cannot instantiate " + cls, ex);
-        } finally {
-            if (mustUnset) {
-                Reflection.setAccessible(cons, false);
-            }
-        }
-    }
-
-    // Helpers
-    // -------------------------------------------------------------------
-
-    /**
-     * Validates a bean and all its cascaded related beans for the currently defined group.
-     * <p/>
-     * Special code is present to manage the {@link Default} group.
-     *
-     * @param context The current context of this validation call. Must have its
-     *                          {@link GroupValidationContext#getCurrentGroup()} field set.
-     */
-    protected void validateBeanNet(GroupValidationContext<?> context) {
-
-        // If reached a cascaded bean which is null
-        if (context.getBean() == null) {
-            return;
-        }
-
-        // If reached a cascaded bean which has already been validated for the
-        // current group
-        if (!context.collectValidated()) {
-            return;
-        }
-
-        // ### First, validate the bean
-
-        // Default is a special case
-        if (context.getCurrentGroup().isDefault()) {
-
-            List<Group> defaultGroups = expandDefaultGroup(context);
-            final ConstraintValidationListener<?> result = context.getListener();
-
-            // If the rootBean defines a GroupSequence
-            if (defaultGroups != null && defaultGroups.size() > 1) {
-
-                int numViolations = result.violationsSize();
-
-                // Validate the bean for each group in the sequence
-                final Group currentGroup = context.getCurrentGroup();
-                for (final Group each : defaultGroups) {
-                    context.setCurrentGroup(each);
-
-                    // ValidationHelper.validateBean(context);, doesn't match anymore because of @ConvertGroup
-                    validateBean(context);
-
-                    // Spec 3.4.3 - Stop validation if errors already found
-                    if (result.violationsSize() > numViolations) {
-                        break;
-                    }
-                }
-                context.setCurrentGroup(currentGroup);
-            } else {
-
-                // For each class in the hierarchy of classes of rootBean,
-                // validate the constraints defined in that class according
-                // to the GroupSequence defined in the same class
-
-                // Obtain the full class hierarchy
-                final List<Class<?>> classHierarchy = new ArrayList<Class<?>>();
-                ClassHelper.fillFullClassHierarchyAsList(classHierarchy, context.getMetaBean().getBeanClass());
-                final Class<?> initialOwner = context.getCurrentOwner();
-
-                // For each owner in the hierarchy
-                for (final Class<?> owner : classHierarchy) {
-
-                    context.setCurrentOwner(owner);
-
-                    int numViolations = result.violationsSize();
-
-                    // Obtain the group sequence of the owner, and use it for
-                    // the constraints that belong to it
-                    final List<Group> ownerDefaultGroups =
-                        context.getMetaBean().getFeature("{GroupSequence:" + owner.getCanonicalName() + "}");
-                    for (Group each : ownerDefaultGroups) {
-                        context.setCurrentGroup(each);
-                        validateBean(context);
-                        // Spec 3.4.3 - Stop validation if errors already found
-                        if (result.violationsSize() > numViolations) {
-                            break;
-                        }
-                    }
-                }
-                context.setCurrentOwner(initialOwner);
-                context.setCurrentGroup(Group.DEFAULT);
-            }
-        }
-        // if not the default group, proceed as normal
-        else {
-            validateBean(context);
-        }
-
-        // ### Then, the cascaded beans (@Valid)
-        for (final MetaProperty prop : context.getMetaBean().getProperties()) {
-            final Group group = context.getCurrentGroup();
-            final Group mappedGroup;
-
-            final Object feature = prop.getFeature(JsrFeatures.Property.PropertyDescriptor);
-            if (feature == null) {
-                mappedGroup = group;
-            } else {
-                mappedGroup = PropertyDescriptorImpl.class.cast(feature).mapGroup(group);
-            }
-
-            if (group == mappedGroup) {
-                validateCascadedBean(context, prop, null);
-            } else {
-                final Groups propertyGroup = groupsComputer.computeGroups(new Class<?>[] { mappedGroup.getGroup() });
-                validateCascadedBean(context, prop, propertyGroup);
-            }
-            context.setCurrentGroup(group);
-        }
-    }
-
-    // TODO: maybe add a GroupMapper to bval-core to ease this kind of thing and void to fork this method from ValidationHelper
-    private void validateBean(final GroupValidationContext<?> context) {
-        // execute all property level validations
-        for (final PropertyDescriptor prop : getConstraintsForClass(context.getMetaBean().getBeanClass())
-            .getConstrainedProperties()) {
-            final PropertyDescriptorImpl impl = PropertyDescriptorImpl.class.cast(prop);
-            if (!impl.isValidated(impl)) {
-                checkValidationAppliesTo(impl.getConstraintDescriptors(), ConstraintTarget.PARAMETERS);
-                checkValidationAppliesTo(impl.getConstraintDescriptors(), ConstraintTarget.RETURN_VALUE);
-                impl.setValidated(impl); // we don't really care about concurrency here
-            }
-
-            final MetaProperty metaProperty = context.getMetaBean().getProperty(prop.getPropertyName());
-            context.setMetaProperty(metaProperty);
-            final Group current = context.getCurrentGroup();
-            context.setCurrentGroup(impl.mapGroup(current));
-            ValidationHelper.validateProperty(context);
-            context.setCurrentGroup(current);
-        }
-
-        // execute all bean level validations
-        context.setMetaProperty(null);
-        for (final Validation validation : context.getMetaBean().getValidations()) {
-            if (ConstraintValidation.class.isInstance(validation)) {
-                final ConstraintValidation<?> constraintValidation = ConstraintValidation.class.cast(validation);
-                if (!constraintValidation.isValidated()) {
-                    checkValidationAppliesTo(constraintValidation.getValidationAppliesTo(),
-                        ConstraintTarget.PARAMETERS);
-                    checkValidationAppliesTo(constraintValidation.getValidationAppliesTo(),
-                        ConstraintTarget.RETURN_VALUE);
-                    constraintValidation.setValidated(true);
-                }
-            }
-            validation.validate(context);
-        }
-    }
-
-    /**
-     * Checks if the the meta property <code>prop</code> defines a cascaded bean, and in case it does, validates it.
-     *
-     * @param context The current validation context.
-     * @param prop    The property to cascade from (in case it is possible).
-     */
-    private void validateCascadedBean(final GroupValidationContext<?> context, final MetaProperty prop,
-        final Groups groups) {
-        final AccessStrategy[] access = prop.getFeature(Features.Property.REF_CASCADE);
-        if (access != null) { // different accesses to relation
-            // save old values from context
-            final Object bean = context.getBean();
-            final MetaBean mbean = context.getMetaBean();
-            // TODO implement Validation.groups support on related bean
-            //            Class[] groups = prop.getFeature(JsrFeatures.Property.REF_GROUPS);
-            for (final AccessStrategy each : access) {
-                if (isCascadable(context, prop, each)) {
-                    // modify context state for relationship-target bean
-                    context.moveDown(prop, each);
-                    // validate
-                    if (groups == null) {
-                        ValidationHelper.validateContext(context, new JsrValidationCallback(context),
-                            factoryContext.isTreatMapsLikeBeans());
-                    } else {
-                        ValidationHelper.validateContext(context, new ValidationHelper.ValidateCallback() {
-                            @Override
-                            public void validate() {
-                                validateBeanWithGroups(context, groups);
-                            }
-                        }, factoryContext.isTreatMapsLikeBeans());
-                    }
-                    // restore old values in context
-                    context.moveUp(bean, mbean);
-                }
-            }
-        }
-    }
-
-    /**
-     * Before accessing a related bean (marked with {@link javax.validation.Valid}), the validator has to check if it is
-     * reachable and cascadable.
-     *
-     * @param context The current validation context.
-     * @param prop    The property of the related bean.
-     * @param access  The access strategy used to get the related bean value.
-     * @return <code>true</code> if the validator can access the related bean, <code>false</code> otherwise.
-     */
-    private boolean isCascadable(GroupValidationContext<?> context, MetaProperty prop, AccessStrategy access) {
-
-        PathImpl beanPath = context.getPropertyPath();
-        final NodeImpl node = new NodeImpl.PropertyNodeImpl(prop.getName());
-        if (beanPath == null) {
-            beanPath = PathImpl.create();
-        }
-        try {
-            if (!context.getTraversableResolver().isReachable(context.getBean(), node,
-                context.getRootMetaBean().getBeanClass(), beanPath, access.getElementType())) {
-                return false;
-            }
-        } catch (RuntimeException e) {
-            throw new ValidationException("Error in TraversableResolver.isReachable() for " + context.getBean(), e);
-        }
-
-        try {
-            if (!context.getTraversableResolver().isCascadable(context.getBean(), node,
-                context.getRootMetaBean().getBeanClass(), beanPath, access.getElementType())) {
-                return false;
-            }
-        } catch (RuntimeException e) {
-            throw new ValidationException("Error TraversableResolver.isCascadable() for " + context.getBean(), e);
-        }
-        return true;
-    }
-
-    /**
-     * in case of a default group return the list of groups for a redefined default GroupSequence
-     *
-     * @return null when no in default group or default group sequence not redefined
-     */
-    private List<Group> expandDefaultGroup(GroupValidationContext<?> context) {
-        if (context.getCurrentGroup().isDefault()) {
-            // mention if metaBean redefines the default group
-            final List<Group> groupSeq = context.getMetaBean().getFeature(JsrFeatures.Bean.GROUP_SEQUENCE);
-            if (groupSeq != null) {
-                context.getGroups().assertDefaultGroupSequenceIsExpandable(groupSeq);
-            }
-            return groupSeq;
-        }
-        return null;
-    }
-
-    /**
-     * Generate an unrecoverable validation error
-     *
-     * @param ex
-     * @param object
-     * @return a {@link RuntimeException} of the appropriate type
-     */
-    protected static RuntimeException unrecoverableValidationError(RuntimeException ex, Object object) {
-        if (ex instanceof UnknownPropertyException || ex instanceof IncompatiblePropertyValueException) {
-            // Convert to IllegalArgumentException
-            return new IllegalArgumentException(ex.getMessage(), ex);
-        }
-        if (ex instanceof ValidationException) {
-            return ex; // do not wrap specific ValidationExceptions (or instances from subclasses)
-        }
-        String objectId;
-        if (object == null) {
-            objectId = "<null>";
-        } else {
-            try {
-                objectId = object.toString();
-            } catch (Exception e) {
-                objectId = "<unknown>";
-            }
-        }
-        return new ValidationException("error during validation of " + objectId, ex);
-    }
-
-    private void validatePropertyInGroup(final GroupValidationContext<?> context) {
-        final Runnable helper;
-        if (context.getMetaProperty() == null) {
-            helper = new Runnable() {
-
-                @Override
-                public void run() {
-                    ValidationHelper.validateBean(context);
-                }
-            };
-        } else {
-            helper = new Runnable() {
-
-                @Override
-                public void run() {
-                    ValidationHelper.validateProperty(context);
-                }
-            };
-        }
-        final List<Group> defaultGroups = expandDefaultGroup(context);
-        if (defaultGroups == null) {
-            helper.run();
-        } else {
-            final Group currentGroup = context.getCurrentGroup();
-            for (Group each : defaultGroups) {
-                context.setCurrentGroup(each);
-                helper.run();
-                // continue validation, even if errors already found
-            }
-            context.setCurrentGroup(currentGroup); // restore
-        }
-    }
-
-    /**
-     * Create a {@link GroupValidationContext}.
-     *
-     * @param <T>
-     * @param metaBean
-     * @param object
-     * @param objectClass
-     * @param groups
-     * @return {@link GroupValidationContext} instance
-     */
-    protected <T> GroupValidationContext<T> createContext(MetaBean metaBean, T object, Class<T> objectClass,
-        Class<?>... groups) {
-        final ConstraintValidationListener<T> listener = new ConstraintValidationListener<T>(object, objectClass);
-        final GroupValidationContextImpl<T> context = new GroupValidationContextImpl<T>(listener,
-            factoryContext.getMessageInterpolator(), factoryContext.getTraversableResolver(),
-            factoryContext.getParameterNameProvider(), factoryContext.getConstraintValidatorFactory(), metaBean);
-        context.setBean(object, metaBean);
-        context.setGroups(groupsComputer.computeGroups(groups));
-        return context;
-    }
-
-    protected <T> GroupValidationContext<T> createInvocableContext(MetaBean metaBean, T object, Class<T> objectClass,
-        Class<?>... groups) {
-        final ConstraintValidationListener<T> listener = new ConstraintValidationListener<T>(object, objectClass);
-        final GroupValidationContextImpl<T> context = new GroupValidationContextImpl<T>(listener,
-            factoryContext.getMessageInterpolator(), factoryContext.getTraversableResolver(),
-            factoryContext.getParameterNameProvider(), factoryContext.getConstraintValidatorFactory(), metaBean);
-        context.setBean(object, metaBean);
-        final Groups computedGroup = groupsComputer.computeGroups(groups);
-        if (Collections.singletonList(Group.DEFAULT).equals(computedGroup.getGroups())
-            && metaBean.getFeature(JsrFeatures.Bean.GROUP_SEQUENCE) != null) {
-            final Groups sequence = new Groups();
-            @SuppressWarnings("unchecked")
-            final List<? extends Group> sequenceGroups =
-                List.class.cast(metaBean.getFeature(JsrFeatures.Bean.GROUP_SEQUENCE));
-            sequence.getGroups().addAll(sequenceGroups);
-            context.setGroups(sequence);
-        } else {
-            context.setGroups(computedGroup);
-        }
-        return context;
-    }
-
-    /**
-     * Create a {@link BeanDescriptorImpl}
-     *
-     * @param metaBean
-     * @return {@link BeanDescriptorImpl} instance
-     */
-    protected BeanDescriptorImpl createBeanDescriptor(MetaBean metaBean) {
-        return new BeanDescriptorImpl(factoryContext, metaBean);
-    }
-
-    /**
-     * Checks that the property name is valid according to spec Section 4.1.1 i. Throws an
-     * {@link IllegalArgumentException} if it is not.
-     *
-     * @param propertyName Property name to check.
-     */
-    private void checkPropertyName(String propertyName) {
-        if (propertyName == null || propertyName.trim().isEmpty()) {
-            throw new IllegalArgumentException("Property path cannot be null or empty.");
-        }
-    }
-
-    /**
-     * Checks that the groups array is valid according to spec Section 4.1.1 i. Throws an
-     * {@link IllegalArgumentException} if it is not.
-     *
-     * @param groups The groups to check.
-     */
-    private void checkGroups(Class<?>[] groups) {
-        for (final Class<?> c : notNull("groups", groups)) {
-            notNull("group", c);
-        }
-    }
-
-    @Override
-    public <T> Set<ConstraintViolation<T>> validateConstructorParameters(Constructor<? extends T> constructor,
-        Object[] parameterValues, Class<?>... gps) {
-        notNull("Constructor", constructor);
-        notNull("Groups", gps);
-        notNull("Parameters", parameterValues);
-
-        final Class<?> declaringClass = constructor.getDeclaringClass();
-        final ConstructorDescriptorImpl constructorDescriptor = ConstructorDescriptorImpl.class
-            .cast(getConstraintsForClass(declaringClass).getConstraintsForConstructor(constructor.getParameterTypes()));
-        if (constructorDescriptor == null) { // no constraint
-            return Collections.emptySet();
-        }
-
-        // sanity checks
-        if (!constructorDescriptor.isValidated(constructor)) {
-            if (parameterValues.length == 0) {
-                checkValidationAppliesTo(Collections.singleton(constructorDescriptor.getCrossParameterDescriptor()),
-                    ConstraintTarget.PARAMETERS);
-                checkValidationAppliesTo(constructorDescriptor.getParameterDescriptors(), ConstraintTarget.PARAMETERS);
-            } else {
-                checkValidationAppliesTo(Collections.singleton(constructorDescriptor.getCrossParameterDescriptor()),
-                    ConstraintTarget.IMPLICIT);
-                checkValidationAppliesTo(constructorDescriptor.getParameterDescriptors(), ConstraintTarget.IMPLICIT);
-            }
-            constructorDescriptor.setValidated(constructor);
-        }
-
-        // validations
-        return validateInvocationParameters(constructor, parameterValues, constructorDescriptor, gps,
-            new NodeImpl.ConstructorNodeImpl(declaringClass.getSimpleName(),
-                Arrays.asList(constructor.getParameterTypes())),
-            null);
-    }
-
-    private <T> Set<ConstraintViolation<T>> validateInvocationParameters(final Member invocable,
-        final Object[] parameterValues, final InvocableElementDescriptor constructorDescriptor, final Class<?>[] gps,
-        final NodeImpl rootNode, final Object rootBean) {
-        final Set<ConstraintViolation<T>> violations = new HashSet<ConstraintViolation<T>>();
-
-        @SuppressWarnings("unchecked")
-        final GroupValidationContext<ConstraintValidationListener<?>> parametersContext = createInvocableContext(
-            constructorDescriptor.getMetaBean(), rootBean, Class.class.cast(invocable.getDeclaringClass()), gps);
-
-        @SuppressWarnings("unchecked")
-        final GroupValidationContext<Object> crossParameterContext = createContext(constructorDescriptor.getMetaBean(),
-            rootBean, Class.class.cast(invocable.getDeclaringClass()), gps);
-
-        if (rootBean == null) {
-            final Constructor<?> m = Constructor.class.cast(invocable);
-            parametersContext.setConstructor(m);
-            crossParameterContext.setConstructor(m);
-        } else { // could be more sexy but that's ok for now
-            final Method m = Method.class.cast(invocable);
-            parametersContext.setMethod(m);
-            crossParameterContext.setMethod(m);
-        }
-
-        final Groups groups = parametersContext.getGroups();
-
-        final List<ParameterDescriptor> parameterDescriptors = constructorDescriptor.getParameterDescriptors();
-        final ElementDescriptorImpl crossParamDescriptor =
-            ElementDescriptorImpl.class.cast(constructorDescriptor.getCrossParameterDescriptor());
-        final Set<ConstraintDescriptor<?>> crossParamConstraints = crossParamDescriptor.getConstraintDescriptors();
-
-        crossParameterContext.setBean(parameterValues);
-        crossParameterContext.moveDown(rootNode);
-        crossParameterContext.moveDown("<cross-parameter>");
-        crossParameterContext.setKind(ElementKind.CROSS_PARAMETER);
-
-        parametersContext.moveDown(rootNode);
-        parametersContext.setParameters(parameterValues);
-
-        for (final Group current : groups.getGroups()) {
-            for (int i = 0; i < parameterValues.length; i++) {
-                final ParameterDescriptorImpl paramDesc =
-                    ParameterDescriptorImpl.class.cast(parameterDescriptors.get(i));
-                parametersContext.setBean(parameterValues[i]);
-                parametersContext.moveDown(new NodeImpl.ParameterNodeImpl(paramDesc.getName(), i));
-                for (final ConstraintDescriptor<?> constraintDescriptor : paramDesc.getConstraintDescriptors()) {
-                    final ConstraintValidation<?> validation = ConstraintValidation.class.cast(constraintDescriptor);
-                    parametersContext.setCurrentGroup(paramDesc.mapGroup(current));
-                    validation.validateGroupContext(parametersContext);
-                }
-                parametersContext.moveUp(null, null);
-            }
-
-            for (final ConstraintDescriptor<?> d : crossParamConstraints) {
-                final ConstraintValidation<?> validation = ConstraintValidation.class.cast(d);
-                crossParameterContext.setCurrentGroup(crossParamDescriptor.mapGroup(current));
-                validation.validateGroupContext(crossParameterContext);
-            }
-
-            if (gps.length == 0 && parametersContext.getListener().getConstraintViolations().size()
-                + crossParameterContext.getListener().getConstraintViolations().size() > 0) {
-                break;
-            }
-        }
-
-        for (final Group current : groups.getGroups()) {
-            for (int i = 0; i < parameterValues.length; i++) {
-                final ParameterDescriptorImpl paramDesc =
-                    ParameterDescriptorImpl.class.cast(parameterDescriptors.get(i));
-                if (paramDesc.isCascaded() && parameterValues[i] != null) {
-                    parametersContext.setBean(parameterValues[i]);
-                    parametersContext.moveDown(new NodeImpl.ParameterNodeImpl(paramDesc.getName(), i));
-                    initMetaBean(parametersContext, factoryContext.getMetaBeanFinder(), parameterValues[i].getClass());
-                    parametersContext.setCurrentGroup(paramDesc.mapGroup(current));
-                    ValidationHelper.validateContext(parametersContext, new JsrValidationCallback(parametersContext),
-                        factoryContext.isTreatMapsLikeBeans());
-                    parametersContext.moveUp(null, null);
-                }
-            }
-        }
-
-        for (final List<Group> eachSeq : groups.getSequences()) {
-            for (final Group current : eachSeq) {
-                for (int i = 0; i < parameterValues.length; i++) {
-                    final ParameterDescriptorImpl paramDesc =
-                        ParameterDescriptorImpl.class.cast(parameterDescriptors.get(i));
-                    parametersContext.setBean(parameterValues[i]);
-                    parametersContext.moveDown(new NodeImpl.ParameterNodeImpl(paramDesc.getName(), i));
-                    for (final ConstraintDescriptor<?> constraintDescriptor : paramDesc.getConstraintDescriptors()) {
-                        final ConstraintValidation<?> validation =
-                            ConstraintValidation.class.cast(constraintDescriptor);
-                        parametersContext.setCurrentGroup(paramDesc.mapGroup(current));
-                        validation.validateGroupContext(parametersContext);
-                    }
-                    parametersContext.moveUp(null, null);
-                }
-
-                for (final ConstraintDescriptor<?> d : crossParamConstraints) {
-                    final ConstraintValidation<?> validation = ConstraintValidation.class.cast(d);
-                    crossParameterContext.setCurrentGroup(crossParamDescriptor.mapGroup(current));
-                    validation.validateGroupContext(crossParameterContext);
-                }
-
-                if (parametersContext.getListener().getConstraintViolations().size()
-                    + crossParameterContext.getListener().getConstraintViolations().size() > 0) {
-                    break;
-                }
-            }
-
-            for (final Group current : eachSeq) {
-                for (int i = 0; i < parameterValues.length; i++) {
-                    final ParameterDescriptorImpl paramDesc =
-                        ParameterDescriptorImpl.class.cast(parameterDescriptors.get(i));
-                    if (paramDesc.isCascaded() && parameterValues[i] != null) {
-                        parametersContext.setBean(parameterValues[i]);
-                        parametersContext.moveDown(new NodeImpl.ParameterNodeImpl(paramDesc.getName(), i));
-                        initMetaBean(parametersContext, factoryContext.getMetaBeanFinder(),
-                            parameterValues[i].getClass());
-                        parametersContext.setCurrentGroup(paramDesc.mapGroup(current));
-                        ValidationHelper.validateContext(parametersContext,
-                            new JsrValidationCallback(parametersContext), factoryContext.isTreatMapsLikeBeans());
-                        parametersContext.moveUp(null, null);
-                    }
-                }
-            }
-        }
-        if (constructorDescriptor.isCascaded()) {
-            if (parametersContext.getValidatedValue() != null) {
-                initMetaBean(parametersContext, factoryContext.getMetaBeanFinder(),
-                    parametersContext.getValidatedValue().getClass());
-
-                for (final Group current : groups.getGroups()) {
-                    parametersContext.setCurrentGroup(constructorDescriptor.mapGroup(current));
-                    ValidationHelper.validateContext(parametersContext, new JsrValidationCallback(parametersContext),
-                        factoryContext.isTreatMapsLikeBeans());
-                }
-                for (final List<Group> eachSeq : groups.getSequences()) {
-                    for (final Group current : eachSeq) {
-                        parametersContext.setCurrentGroup(constructorDescriptor.mapGroup(current));
-                        ValidationHelper.validateContext(parametersContext,
-                            new JsrValidationCallback(parametersContext), factoryContext.isTreatMapsLikeBeans());
-                        if (!parametersContext.getListener().isEmpty()) {
-                            break;
-                        }
-                    }
-                }
-            }
-            if (crossParameterContext.getValidatedValue() != null) {
-                initMetaBean(crossParameterContext, factoryContext.getMetaBeanFinder(),
-                    crossParameterContext.getValidatedValue().getClass());
-
-                for (final Group current : groups.getGroups()) {
-                    crossParameterContext.setCurrentGroup(constructorDescriptor.mapGroup(current));
-                    ValidationHelper.validateContext(crossParameterContext,
-                        new JsrValidationCallback(crossParameterContext), factoryContext.isTreatMapsLikeBeans());
-                }
-                for (final List<Group> eachSeq : groups.getSequences()) {
-                    for (final Group current : eachSeq) {
-                        crossParameterContext.setCurrentGroup(constructorDescriptor.mapGroup(current));
-                        ValidationHelper.validateContext(crossParameterContext,
-                            new JsrValidationCallback(crossParameterContext), factoryContext.isTreatMapsLikeBeans());
-                        if (!crossParameterContext.getListener().isEmpty()) {
-                            break;
-                        }
-                    }
-                }
-            }
-        }
-
-        @SuppressWarnings("unchecked")
-        final Set<ConstraintViolation<T>> parameterViolations =
-            Set.class.cast(parametersContext.getListener().getConstraintViolations());
-        violations.addAll(parameterViolations);
-        @SuppressWarnings("unchecked")
-        final Set<ConstraintViolation<T>> crossParameterViolations =
-            Set.class.cast(crossParameterContext.getListener().getConstraintViolations());
-        violations.addAll(crossParameterViolations);
-
-        return violations;
-    }
-
-    private static void checkValidationAppliesTo(final Collection<? extends ElementDescriptor> descriptors,
-        final ConstraintTarget forbidden) {
-        for (final ElementDescriptor descriptor : descriptors) {
-            for (final ConstraintDescriptor<?> consDesc : descriptor.getConstraintDescriptors()) {
-                checkValidationAppliesTo(consDesc.getValidationAppliesTo(), forbidden);
-            }
-        }
-    }
-
-    private static void checkValidationAppliesTo(final Set<ConstraintDescriptor<?>> constraintDescriptors,
-        final ConstraintTarget forbidden) {
-        for (final ConstraintDescriptor<?> descriptor : constraintDescriptors) {
-            checkValidationAppliesTo(descriptor.getValidationAppliesTo(), forbidden);
-        }
-    }
-
-    private static void checkValidationAppliesTo(final ConstraintTarget configured, final ConstraintTarget forbidden) {
-        if (forbidden.equals(configured)) {
-            throw new ConstraintDeclarationException(forbidden.name() + " forbidden here");
-        }
-    }
-
-    @Override
-    public <T> Set<ConstraintViolation<T>> validateConstructorReturnValue(final Constructor<? extends T> constructor,
-        final T createdObject, final Class<?>... gps) {
-        notNull("Constructor", constructor);
-        notNull("Returned value", createdObject);
-
-        final Class<? extends T> declaringClass = constructor.getDeclaringClass();
-        final ConstructorDescriptorImpl methodDescriptor = ConstructorDescriptorImpl.class
-            .cast(getConstraintsForClass(declaringClass).getConstraintsForConstructor(constructor.getParameterTypes()));
-        if (methodDescriptor == null) {
-            throw new ValidationException("Constructor " + constructor + " doesn't belong to class " + declaringClass);
-        }
-
-        return validateReturnedValue(
-            new NodeImpl.ConstructorNodeImpl(declaringClass.getSimpleName(),
-                Arrays.asList(constructor.getParameterTypes())),
-            createdObject, declaringClass, methodDescriptor, gps, null);
-    }
-
-    private <T> Set<ConstraintViolation<T>> validateReturnedValue(final NodeImpl rootNode, final T createdObject,
-        final Class<?> clazz, final InvocableElementDescriptor methodDescriptor, final Class<?>[] gps,
-        final Object rootBean) {
-        final ElementDescriptorImpl returnedValueDescriptor =
-            ElementDescriptorImpl.class.cast(methodDescriptor.getReturnValueDescriptor());
-        final Set<ConstraintDescriptor<?>> returnedValueConstraints =
-            returnedValueDescriptor.getConstraintDescriptors();
-
-        @SuppressWarnings("unchecked")
-        final GroupValidationContext<T> context = createInvocableContext(methodDescriptor.getMetaBean(), createdObject,
-            Class.class.cast(Proxies.classFor(clazz)), gps);
-        context.moveDown(rootNode);
-        context.moveDown(new NodeImpl.ReturnValueNodeImpl());
-        context.setReturnValue(rootBean);
-
-        final Groups groups = context.getGroups();
-
-        for (final Group current : groups.getGroups()) {
-            for (final ConstraintDescriptor<?> d : returnedValueConstraints) {
-                final ConstraintValidation<?> validation = ConstraintValidation.class.cast(d);
-                context.setCurrentGroup(returnedValueDescriptor.mapGroup(current));
-                validation.validateGroupContext(context);
-            }
-            if (gps.length == 0 && !context.getListener().getConstraintViolations().isEmpty()) {
-                break;
-            }
-        }
-
-        int currentViolationNumber = context.getListener().getConstraintViolations().size();
-        for (final Group current : groups.getGroups()) {
-            if (returnedValueDescriptor.isCascaded() && context.getValidatedValue() != null) {
-                context.setBean(createdObject);
-                initMetaBean(context, factoryContext.getMetaBeanFinder(), context.getValidatedValue().getClass());
-
-                context.setCurrentGroup(methodDescriptor.mapGroup(current));
-                ValidationHelper.validateContext(context, new JsrValidationCallback(context),
-                    factoryContext.isTreatMapsLikeBeans());
-
-                if (currentViolationNumber < context.getListener().getConstraintViolations().size()) {
-                    break;
-                }
-            }
-        }
-
-        for (final List<Group> eachSeq : groups.getSequences()) {
-            for (final Group current : eachSeq) {
-                for (final ConstraintDescriptor<?> d : returnedValueConstraints) {
-                    final ConstraintValidation<?> validation = ConstraintValidation.class.cast(d);
-                    context.setCurrentGroup(current);
-                    validation.validateGroupContext(context);
-                }
-                if (!context.getListener().getConstraintViolations().isEmpty()) {
-                    break;
-                }
-            }
-
-            currentViolationNumber = context.getListener().getConstraintViolations().size();
-            for (final Group current : eachSeq) {
-                if (returnedValueDescriptor.isCascaded() && context.getValidatedValue() != null) {
-                    context.setBean(createdObject);
-                    initMetaBean(context, factoryContext.getMetaBeanFinder(), context.getValidatedValue().getClass());
-
-                    context.setCurrentGroup(methodDescriptor.mapGroup(current));
-                    ValidationHelper.validateContext(context, new JsrValidationCallback(context),
-                        factoryContext.isTreatMapsLikeBeans());
-
-                    if (currentViolationNumber < context.getListener().getConstraintViolations().size()) {
-                        break;
-                    }
-                }
-            }
-        }
-
-        return context.getListener().getConstraintViolations();
-    }
-
-    @Override
-    public <T> Set<ConstraintViolation<T>> validateParameters(T object, Method method, Object[] parameterValues,
-        Class<?>... groups) {
-        notNull("Object", object);
-        notNull("Parameters", parameterValues);
-        notNull("Method", method);
-        notNull("Groups", groups);
-        for (final Class<?> g : groups) {
-            notNull("Each group", g);
-        }
-
-        final MethodDescriptorImpl methodDescriptor = findMethodDescriptor(object, method);
-        if (methodDescriptor == null
-            || !(methodDescriptor.hasConstrainedParameters() || methodDescriptor.hasConstrainedReturnValue())) { // no constraint
-            return Collections.emptySet();
-        }
-
-        if (!methodDescriptor.isValidated(method)) {
-            if (method.getParameterTypes().length == 0) {
-                checkValidationAppliesTo(Collections.singleton(methodDescriptor.getCrossParameterDescriptor()),
-                    ConstraintTarget.PARAMETERS);
-                checkValidationAppliesTo(methodDescriptor.getParameterDescriptors(), ConstraintTarget.PARAMETERS);
-            } else if (!Void.TYPE.equals(method.getReturnType())) {
-                checkValidationAppliesTo(Collections.singleton(methodDescriptor.getCrossParameterDescriptor()),
-                    ConstraintTarget.IMPLICIT);
-                checkValidationAppliesTo(methodDescriptor.getParameterDescriptors(), ConstraintTarget.IMPLICIT);
-            }
-            methodDescriptor.setValidated(method);
-        }
-        return validateInvocationParameters(method, parameterValues, methodDescriptor, groups,
-            new NodeImpl.MethodNodeImpl(method.getName(), Arrays.asList(method.getParameterTypes())), object);
-    }
-
-    private static <T> T notNull(final String entity, final T shouldntBeNull) {
-        if (shouldntBeNull == null) {
-            throw new IllegalArgumentException(entity + " cannot be null");
-        }
-        return shouldntBeNull;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <T> Set<ConstraintViolation<T>> validateReturnValue(T object, Method method, Object returnValue,
-        Class<?>... groups) {
-        notNull("object", object);
-        notNull("method", method);
-        notNull("groups", groups);
-
-        final MethodDescriptorImpl methodDescriptor = findMethodDescriptor(object, method);
-        if (methodDescriptor == null) {
-            throw new ValidationException("Method " + method + " doesn't belong to class " + object.getClass());
-        }
-
-        if (method.getReturnType() == Void.TYPE) {
-            checkValidationAppliesTo(methodDescriptor.getReturnValueDescriptor().getConstraintDescriptors(),
-                ConstraintTarget.RETURN_VALUE);
-        }
-
-        @SuppressWarnings("unchecked")
-        final Set<ConstraintViolation<T>> result = Set.class.cast(validateReturnedValue(
-            new NodeImpl.MethodNodeImpl(method.getName(), Arrays.asList(method.getParameterTypes())), returnValue,
-            object.getClass(), methodDescriptor, groups, object));
-        return result;
-    }
-
-    private <T> MethodDescriptorImpl findMethodDescriptor(final T object, final Method method) {
-        return MethodDescriptorImpl.class
-            .cast(BeanDescriptorImpl.class.cast(getConstraintsForClass(Proxies.classFor(method.getDeclaringClass())))
-                .getInternalConstraintsForMethod(method.getName(), method.getParameterTypes()));
-    }
-
-    private <T> void initMetaBean(final GroupValidationContext<T> context, final MetaBeanFinder metaBeanFinder,
-        final Class<?> directValueClass) {
-        if (directValueClass.isArray()) {
-            context.setMetaBean(metaBeanFinder.findForClass(directValueClass.getComponentType()));
-            return;
-        }
-        if (Collection.class.isAssignableFrom(directValueClass)) {
-            final Collection<?> coll = Collection.class.cast(context.getValidatedValue());
-            if (!coll.isEmpty()) {
-                context.setMetaBean(metaBeanFinder.findForClass(coll.iterator().next().getClass()));
-                return;
-            }
-        }
-        if (Map.class.isAssignableFrom(directValueClass)) {
-            final Map<?, ?> m = Map.class.cast(context.getValidatedValue());
-            if (!m.isEmpty()) {
-                context.setMetaBean(metaBeanFinder.findForClass(m.values().iterator().next().getClass()));
-                return;
-            }
-        }
-        context.setMetaBean(metaBeanFinder.findForClass(directValueClass));
-    }
-
-    /**
-     * Dispatches a call from {@link #validate()} to {@link ClassValidator#validateBeanNet(GroupValidationContext)} with
-     * the current context set.
-     */
-    protected class JsrValidationCallback implements ValidationHelper.ValidateCallback {
-
-        private final GroupValidationContext<?> context;
-
-        public JsrValidationCallback(GroupValidationContext<?> context) {
-            this.context = context;
-        }
-
-        @Override
-        public void validate() {
-            validateBeanNet(context);
-        }
-
-    }
-
-    /**
-     * Create a {@link ValidationContextTraversal} instance for this {@link ClassValidator}.
-     * 
-     * @param validationContext
-     * @return {@link ValidationContextTraversal}
-     */
-    protected ValidationContextTraversal createValidationContextTraversal(GroupValidationContext<?> validationContext) {
-        return new ValidationContextTraversal(validationContext);
-    }
-
-    /**
-     * Implement {@link #validateProperty(Object, String, boolean, Class[])} } and
-     * {@link #validateValue(Class, String, Object, boolean, Class...)}.
-     * 
-     * @param <T>
-     * @param beanType
-     * @param object
-     * @param propertyName
-     * @param value
-     * @param cascade
-     * @param groups
-     * @return {@link ConstraintViolation} {@link Set}
-     */
-    private <T> Set<ConstraintViolation<T>> validateValueImpl(Class<T> beanType, T object, String propertyName,
-        Object value, final boolean cascade, Class<?>... groups) {
-
-        assert (object == null) ^ (value == VALIDATE_PROPERTY);
-        checkPropertyName(propertyName);
-        checkGroups(groups);
-
-        try {
-            final MetaBean initialMetaBean = new DynamicMetaBean(metaBeanFinder);
-            initialMetaBean.setBeanClass(beanType);
-            GroupValidationContext<T> context = createContext(initialMetaBean, object, beanType, groups);
-            ValidationContextTraversal contextTraversal = createValidationContextTraversal(context);
-            PathNavigation.navigate(propertyName, contextTraversal);
-
-            MetaProperty prop = context.getMetaProperty();
-            boolean fixed = false;
-            if (value != VALIDATE_PROPERTY) {
-                assert !context.getPropertyPath().isRootPath();
-                if (prop == null && value != null) {
-                    context.setMetaBean(metaBeanFinder.findForClass(value.getClass()));
-                }
-                if (!cascade) {
-                    //TCK doesn't care what type a property is if there are no constraints to validate:
-                    FeaturesCapable meta = prop == null ? context.getMetaBean() : prop;
-
-                    Validation[] validations = meta.getValidations();
-                    if (validations == null || validations.length == 0) {
-                        return Collections.<ConstraintViolation<T>> emptySet();
-                    }
-                }
-                if (!TypeUtils.isAssignable(value == null ? null : value.getClass(), contextTraversal.getType())) {
-                    throw new IncompatiblePropertyValueException(String.format(
-                        "%3$s is not a valid value for property %2$s of type %1$s", beanType, propertyName, value));
-                }
-                if (prop == null) {
-                    context.setBean(value);
-                } else {
-                    context.setFixedValue(value);
-                    fixed = true;
-                }
-            }
-            boolean doCascade = cascade && (prop == null || prop.getMetaBean() != null);
-
-            Object bean = context.getBean();
-
-            ConstraintValidationListener<T> result = context.getListener();
-            Groups sequence = context.getGroups();
-
-            // 1. process groups
-
-            for (Group current : sequence.getGroups()) {
-                context.setCurrentGroup(current);
-
-                if (!doCascade || prop != null) {
-                    validatePropertyInGroup(context);
-                }
-                if (doCascade) {
-                    contextTraversal.moveDownIfNecessary();
-                    if (context.getMetaBean() instanceof DynamicMetaBean) {
-                        context.setMetaBean(context.getMetaBean().resolveMetaBean(
-                            ObjectUtils.defaultIfNull(context.getBean(), contextTraversal.getRawType())));
-                    }
-                    validateBeanNet(context);
-                    if (prop != null) {
-                        context.moveUp(bean, prop.getParentMetaBean());
-                        context.setMetaProperty(prop);
-                        if (fixed) {
-                            context.setFixedValue(value);
-                        }
-                    }
-                }
-            }
-
-            // 2. process sequences
-
-            int groupViolations = result.getConstraintViolations().size();
-
-            outer: for (List<Group> eachSeq : sequence.getSequences()) {
-                for (Group current : eachSeq) {
-                    context.setCurrentGroup(current);
-
-                    if (!doCascade || prop != null) {
-                        validatePropertyInGroup(context);
-                    }
-                    if (doCascade) {
-                        contextTraversal.moveDownIfNecessary();
-                        if (context.getMetaBean() instanceof DynamicMetaBean) {
-                            context.setMetaBean(context.getMetaBean().resolveMetaBean(
-                                ObjectUtils.defaultIfNull(context.getBean(), contextTraversal.getRawType())));
-                        }
-                        validateBeanNet(context);
-                        if (prop != null) {
-                            context.moveUp(bean, prop.getParentMetaBean());
-                            context.setMetaProperty(prop);
-                            if (fixed) {
-                                context.setFixedValue(value);
-                            }
-                        }
-                    }
-                    /**
-                     * if one of the group process in the sequence leads to one or more validation failure, the groups
-                     * following in the sequence must not be processed
-                     */
-                    if (result.getConstraintViolations().size() > groupViolations)
-                        break outer;
-                }
-            }
-            return result.getConstraintViolations();
-        } catch (RuntimeException ex) {
-            throw unrecoverableValidationError(ex, ObjectUtils.defaultIfNull(object, value));
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintCached.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintCached.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintCached.java
index 28379b7..e412c30 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintCached.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintCached.java
@@ -28,7 +28,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
-import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintDescriptorImpl.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintDescriptorImpl.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintDescriptorImpl.java
deleted file mode 100644
index c4c9d99..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintDescriptorImpl.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.bval.jsr;
-
-import javax.validation.ConstraintTarget;
-import javax.validation.Payload;
-import javax.validation.metadata.ConstraintDescriptor;
-import javax.validation.metadata.ValidateUnwrappedValue;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Immutable, {@link Serializable} {@link ConstraintDescriptor} implementation.
- *
- * User: roman.stumm<br>
- * Date: 22.04.2010<br>
- * Time: 10:21:23<br>
- */
-public class ConstraintDescriptorImpl<T extends Annotation> implements ConstraintDescriptor<T>, Serializable {
-    /** Serialization version */
-    private static final long serialVersionUID = 1L;
-
-    private final T annotation;
-    private final Set<Class<?>> groups;
-    private final Set<Class<? extends javax.validation.Payload>> payload;
-    private final List<java.lang.Class<? extends javax.validation.ConstraintValidator<T, ?>>> constraintValidatorClasses;
-    private final Map<String, Object> attributes;
-    private final Set<ConstraintDescriptor<?>> composingConstraints;
-    private final boolean reportAsSingleViolation;
-    private final ConstraintTarget validationAppliesTo;
-    private final String template;
-    private final int hashCode;
-
-    /**
-     * Create a new ConstraintDescriptorImpl instance.
-     * 
-     * @param descriptor
-     */
-    public ConstraintDescriptorImpl(final ConstraintDescriptor<T> descriptor) {
-        this(descriptor.getAnnotation(), descriptor.getGroups(), descriptor.getPayload(),
-            descriptor.getConstraintValidatorClasses(), descriptor.getAttributes(),
-            descriptor.getComposingConstraints(), descriptor.isReportAsSingleViolation(),
-            descriptor.getValidationAppliesTo(), descriptor.getMessageTemplate());
-    }
-
-    /**
-     * Create a new ConstraintDescriptorImpl instance.
-     * 
-     * @param annotation
-     * @param groups
-     * @param payload
-     * @param constraintValidatorClasses
-     * @param attributes
-     * @param composingConstraints
-     * @param reportAsSingleViolation
-     */
-    public ConstraintDescriptorImpl(T annotation, Set<Class<?>> groups,
-        Set<Class<? extends javax.validation.Payload>> payload,
-        List<java.lang.Class<? extends javax.validation.ConstraintValidator<T, ?>>> constraintValidatorClasses,
-        Map<String, Object> attributes, Set<ConstraintDescriptor<?>> composingConstraints,
-        boolean reportAsSingleViolation, ConstraintTarget validationAppliesTo, String messageTemplate) {
-        this.annotation = annotation;
-        this.groups = groups;
-        this.payload = payload;
-        this.constraintValidatorClasses = constraintValidatorClasses;
-        this.attributes = attributes;
-        this.composingConstraints = composingConstraints;
-        this.reportAsSingleViolation = reportAsSingleViolation;
-        this.validationAppliesTo = validationAppliesTo;
-        this.template = messageTemplate;
-        this.hashCode = computeHashCode();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public T getAnnotation() {
-        return annotation;
-    }
-
-    @Override
-    public String getMessageTemplate() {
-        return template;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Set<Class<?>> getGroups() {
-        return groups;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Set<Class<? extends Payload>> getPayload() {
-        return payload;
-    }
-
-    @Override
-    public ConstraintTarget getValidationAppliesTo() {
-        return validationAppliesTo;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public List<java.lang.Class<? extends javax.validation.ConstraintValidator<T, ?>>> getConstraintValidatorClasses() {
-        return constraintValidatorClasses;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Map<String, Object> getAttributes() {
-        return attributes;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Set<ConstraintDescriptor<?>> getComposingConstraints() {
-        return composingConstraints;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean isReportAsSingleViolation() {
-        return reportAsSingleViolation;
-    }
-
-    /**
-     * generated equals on all fields except hashCode
-     */
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-
-        ConstraintDescriptorImpl<?> that = (ConstraintDescriptorImpl<?>) o;
-
-        if (reportAsSingleViolation != that.reportAsSingleViolation) {
-            return false;
-        }
-        if (annotation != null ? !annotation.equals(that.annotation) : that.annotation != null) {
-            return false;
-        }
-        if (groups != null ? !groups.equals(that.groups) : that.groups != null) {
-            return false;
-        }
-        if (payload != null ? !payload.equals(that.payload) : that.payload != null) {
-            return false;
-        }
-        if (constraintValidatorClasses != null ? !constraintValidatorClasses.equals(that.constraintValidatorClasses)
-            : that.constraintValidatorClasses != null) {
-            return false;
-        }
-        if (attributes != null ? !attributes.equals(that.attributes) : that.attributes != null) {
-            return false;
-        }
-        if (composingConstraints != null ? !composingConstraints.equals(that.composingConstraints)
-            : that.composingConstraints != null) {
-            return false;
-        }
-        if (validationAppliesTo != that.validationAppliesTo) {
-            return false;
-        }
-        return template != null ? template.equals(that.template) : that.template == null;
-
-    }
-
-    @Override
-    public int hashCode() {
-        return hashCode;
-    }
-
-    /**
-     * generated hashCode on all fields except hashCode
-     */
-    private int computeHashCode() {
-        int result = annotation != null ? annotation.hashCode() : 0;
-        result = 31 * result + (groups != null ? groups.hashCode() : 0);
-        result = 31 * result + (payload != null ? payload.hashCode() : 0);
-        result = 31 * result + (constraintValidatorClasses != null ? constraintValidatorClasses.hashCode() : 0);
-        result = 31 * result + (attributes != null ? attributes.hashCode() : 0);
-        result = 31 * result + (composingConstraints != null ? composingConstraints.hashCode() : 0);
-        result = 31 * result + (reportAsSingleViolation ? 1 : 0);
-        result = 31 * result + (validationAppliesTo != null ? validationAppliesTo.hashCode() : 0);
-        result = 31 * result + (template != null ? template.hashCode() : 0);
-        return result;
-    }
-
-    @Override
-    public ValidateUnwrappedValue getValueUnwrapping() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public <U> U unwrap(Class<U> arg0) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintFinderImpl.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintFinderImpl.java b/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintFinderImpl.java
deleted file mode 100644
index 57680d7..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ConstraintFinderImpl.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.jsr.groups.Group;
-import org.apache.bval.jsr.groups.Groups;
-import org.apache.bval.jsr.groups.GroupsComputer;
-import org.apache.bval.model.MetaBean;
-
-import javax.validation.metadata.ConstraintDescriptor;
-import javax.validation.metadata.ElementDescriptor;
-import javax.validation.metadata.ElementDescriptor.ConstraintFinder;
-import javax.validation.metadata.Scope;
-import java.lang.annotation.ElementType;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Description: Implementation of the fluent {@link ConstraintFinder} interface.<br/>
- */
-final class ConstraintFinderImpl implements ElementDescriptor.ConstraintFinder {
-    private final MetaBean metaBean;
-    private final Set<Scope> findInScopes;
-    private Set<ConstraintValidation<?>> constraintDescriptors;
-
-    /**
-     * Create a new ConstraintFinderImpl instance.
-     * 
-     * @param metaBean
-     * @param constraintDescriptors
-     */
-    ConstraintFinderImpl(MetaBean metaBean, Set<ConstraintValidation<?>> constraintDescriptors) {
-        this.metaBean = metaBean;
-        this.constraintDescriptors = constraintDescriptors;
-        this.findInScopes = new HashSet<Scope>(Arrays.asList(Scope.values()));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ElementDescriptor.ConstraintFinder unorderedAndMatchingGroups(Class<?>... groups) {
-        final Set<ConstraintValidation<?>> matchingDescriptors =
-            new HashSet<ConstraintValidation<?>>(constraintDescriptors.size());
-        final Groups groupChain = new GroupsComputer().computeGroups(groups);
-        for (Group group : groupChain.getGroups()) {
-            if (group.isDefault()) {
-                // If group is default, check if it gets redefined
-                for (Group defaultGroupMember : metaBean.<List<Group>> getFeature(JsrFeatures.Bean.GROUP_SEQUENCE)) {
-                    for (ConstraintValidation<?> descriptor : constraintDescriptors) {
-                        if (isInScope(descriptor) && isInGroup(descriptor, defaultGroupMember)) {
-                            matchingDescriptors.add(descriptor);
-                        }
-                    }
-                }
-            } else {
-                for (ConstraintValidation<?> descriptor : constraintDescriptors) {
-                    if (isInScope(descriptor) && isInGroup(descriptor, group)) {
-                        matchingDescriptors.add(descriptor);
-                    }
-                }
-            }
-        }
-        return thisWith(matchingDescriptors);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ElementDescriptor.ConstraintFinder lookingAt(Scope scope) {
-        if (scope == Scope.LOCAL_ELEMENT) {
-            findInScopes.remove(Scope.HIERARCHY);
-            for (Iterator<ConstraintValidation<?>> it = constraintDescriptors.iterator(); it.hasNext();) {
-                if (!it.next().getOwner().equals(metaBean.getBeanClass())) {
-                    it.remove();
-                }
-            }
-        }
-        return this;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ElementDescriptor.ConstraintFinder declaredOn(ElementType... elementTypes) {
-        final Set<ConstraintValidation<?>> matchingDescriptors =
-            new HashSet<ConstraintValidation<?>>(constraintDescriptors.size());
-        for (ElementType each : elementTypes) {
-            for (ConstraintValidation<?> descriptor : constraintDescriptors) {
-                if (isInScope(descriptor) && isAtElement(descriptor, each)) {
-                    matchingDescriptors.add(descriptor);
-                }
-            }
-        }
-        return thisWith(matchingDescriptors);
-    }
-
-    private boolean isAtElement(ConstraintValidation<?> descriptor, ElementType each) {
-        return descriptor.getAccess().getElementType() == each;
-    }
-
-    private boolean isInScope(ConstraintValidation<?> descriptor) {
-        if (findInScopes.size() == Scope.values().length) {
-            return true; // all scopes
-        }
-        if (metaBean != null) {
-            final boolean isOwner = descriptor.getOwner().equals(metaBean.getBeanClass());
-            for (Scope scope : findInScopes) {
-                switch (scope) {
-                case LOCAL_ELEMENT:
-                    if (isOwner) {
-                        return true;
-                    }
-                    break;
-                case HIERARCHY:
-                    if (!isOwner) {
-                        return true;
-                    }
-                    break;
-                }
-            }
-        }
-        return false;
-    }
-
-    private boolean isInGroup(ConstraintValidation<?> descriptor, Group group) {
-        return descriptor.getGroups().contains(group.getGroup());
-    }
-
-    private ElementDescriptor.ConstraintFinder thisWith(Set<ConstraintValidation<?>> matchingDescriptors) {
-        constraintDescriptors = matchingDescriptors;
-        return this;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Set<ConstraintDescriptor<?>> getConstraintDescriptors() {
-        if (constraintDescriptors.isEmpty()) {
-            return Collections.emptySet();
-        }
-        return Collections.<ConstraintDescriptor<?>> unmodifiableSet(constraintDescriptors);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean hasConstraints() {
-        return !constraintDescriptors.isEmpty();
-    }
-}