bval-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: svn commit: r1628598 [1/2] - in /bval/branches/bval-11: ./ bval-core/ bval-core/src/main/java/org/apache/bval/ bval-core/src/main/java/org/apache/bval/model/ bval-core/src/main/java/org/apache/bval/util/ bval-core/src/main/java/org/apache/bval/util/ref...
Date Sat, 06 Dec 2014 12:57:14 GMT
Yep

Not an issue afaik
Le 6 déc. 2014 13:41, "Roman Stumm" <roman.stumm@gmx.de> a écrit :

> I can compile the trunk with java7, but not with java8:
>
> [ERROR] Failed to execute goal org.apache.maven.plugins:
> maven-compiler-plugin:2.3.2:compile (default-compile) on project
> bval-jsr303: Compilation failure: Compilation failure:
> [ERROR] /Users/roman/projects/apache/bval-trunk/bval-jsr303/src/
> main/java/org/apache/bval/jsr303/ConstraintValidation.java:[141,8] error:
> reference to validate is ambiguous
> [ERROR]
> [ERROR] L extends ValidationListener declared in method
> <L>validate(ValidationContext<L>)
> [ERROR] /Users/roman/projects/apache/bval-trunk/bval-jsr303/src/
> main/java/org/apache/bval/jsr303/ConstraintValidation.java:[180,35]
> error: reference to validate is ambiguous
> [ERROR]
> [ERROR] L extends ValidationListener declared in method
> <L>validate(ValidationContext<L>)
> [ERROR] /Users/roman/projects/apache/bval-trunk/bval-jsr303/src/
> main/java/org/apache/bval/jsr303/ConstraintValidation.java:[197,24]
> error: reference to validate is ambiguous
> [ERROR]
> [ERROR] L extends ValidationListener declared in method
> <L>validate(ValidationContext<L>)
> [ERROR] /Users/roman/projects/apache/bval-trunk/bval-jsr303/src/
> main/java/org/apache/bval/jsr303/extensions/MethodValidatorImpl.java:[209,26]
> error: reference to validate is ambiguous
>
> Am 06.12.14 13:12, schrieb Daniel Cunha:
>
>> I try see something here.
>>
>> But I have a problem.. my laptop not build bval.
>> The build stop in Building Apache BVal :: bval-jsr 1.1.0-alpha-SNAPSHOT
>>
>> Linux 3.13.0 32bits
>> 4GB ram
>> JDK 1.8.0_25
>>
>> On Sat, Dec 6, 2014 at 8:08 AM, Romain Manni-Bucau <rmannibucau@gmail.com
>> >
>> wrote:
>>
>>  Hi Matt,
>>>
>>> I have 2 questions:
>>> 1) surely obvious but I dont get why you re-set the accessible (if
>>> (mustSet)). While we need it accessible we can keep it set to true no?
>>> 2) more important: tck are broken now Tests run: 758, Failures: 13,
>>> Errors: 0, Skipped: 0 (mvn clean install -Ptck11) :(
>>>
>>>
>>> Romain Manni-Bucau
>>> @rmannibucau
>>> http://www.tomitribe.com
>>> http://rmannibucau.wordpress.com
>>> https://github.com/rmannibucau
>>>
>>>
>>>
>>> ---------- Forwarded message ----------
>>> From:  <mbenson@apache.org>
>>> Date: 2014-10-01 6:37 GMT+02:00
>>> Subject: svn commit: r1628598 [1/2] - in /bval/branches/bval-11: ./
>>> bval-core/ bval-core/src/main/java/org/apache/bval/
>>> bval-core/src/main/java/org/apache/bval/model/
>>> bval-core/src/main/java/org/apache/bval/util/
>>> bval-core/src/main/java/org/apache/bval/util/ref...
>>> To: commits@bval.apache.org
>>>
>>>
>>> Author: mbenson
>>> Date: Wed Oct  1 04:37:36 2014
>>> New Revision: 1628598
>>>
>>> URL: http://svn.apache.org/r1628598
>>> Log:
>>> use commons weaver/privilizer
>>>
>>> Removed:
>>>
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/reflection/DefaultReflection.java
>>>
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/reflection/SecurityManagerReflection.java
>>> Modified:
>>>      bval/branches/bval-11/bval-core/pom.xml
>>>
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/ConstructorAccess.java
>>>
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/model/MetaBean.java
>>>
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/AccessStrategy.java
>>>
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/BValVersion.java
>>>
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/FieldAccess.java
>>>
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/IndexedAccess.java
>>>
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/KeyedAccess.java
>>>
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/MethodAccess.java
>>>
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/reflection/Reflection.java
>>>      bval/branches/bval-11/bval-jsr/   (props changed)
>>>      bval/branches/bval-11/bval-jsr/pom.xml
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> AnnotationConstraintBuilder.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/AnnotationProcessor.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/ApacheFactoryContext.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> ApacheValidationProvider.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> ApacheValidatorConfiguration.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> ApacheValidatorFactory.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/BeanDescriptorImpl.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/ClassValidator.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/ConfigurationImpl.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> ConstraintAnnotationAttributes.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/ConstraintDefaults.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/ConstraintValidation.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> DefaultMessageInterpolator.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> DefaultValidationProviderResolver.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/JsrMetaBeanFactory.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/resolver/DefaultTraversableResolver.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/util/ClassHelper.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/xml/
>>> AnnotationProxyBuilder.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/xml/
>>> ValidationMappingParser.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/xml/ValidationParser.java
>>>
>>> bval/branches/bval-11/bval-jsr/src/test/java/org/apache/bval/jsr/xml/
>>> ValidationParserTest.java
>>>      bval/branches/bval-11/bval-jsr/src/test/resources/java.policy
>>>      bval/branches/bval-11/bval-tck11/   (props changed)
>>>      bval/branches/bval-11/bval-xstream/pom.xml
>>>
>>> bval/branches/bval-11/bval-xstream/src/main/java/org/apache/bval/xml/
>>> XMLMetaBeanManager.java
>>>      bval/branches/bval-11/pom.xml
>>>
>>> Modified: bval/branches/bval-11/bval-core/pom.xml
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> core/pom.xml?rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> --- bval/branches/bval-11/bval-core/pom.xml (original)
>>> +++ bval/branches/bval-11/bval-core/pom.xml Wed Oct  1 04:37:36 2014
>>> @@ -46,6 +46,10 @@
>>>               <artifactId>commons-beanutils-core</artifactId>
>>>           </dependency>
>>>           <dependency>
>>> +            <groupId>org.apache.commons</groupId>
>>> +            <artifactId>commons-weaver-privilizer-api</artifactId>
>>> +        </dependency>
>>> +        <dependency>
>>>               <groupId>junit</groupId>
>>>               <artifactId>junit</artifactId>
>>>               <scope>test</scope>
>>> @@ -118,6 +122,10 @@ build.timestamp=${timestamp}
>>>                       </execution>
>>>                   </executions>
>>>               </plugin>
>>> +            <plugin>
>>> +               <groupId>org.apache.commons</groupId>
>>> +               <artifactId>commons-weaver-maven-plugin</artifactId>
>>> +            </plugin>
>>>           </plugins>
>>>           <pluginManagement>
>>>                  <plugins>
>>>
>>> Modified:
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/ConstructorAccess.java
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> core/src/main/java/org/apache/bval/ConstructorAccess.java?
>>> rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> ---
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/ConstructorAccess.java
>>> (original)
>>> +++
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/ConstructorAccess.java
>>> Wed Oct  1 04:37:36 2014
>>> @@ -16,13 +16,11 @@
>>>    */
>>>   package org.apache.bval;
>>>
>>> -import org.apache.bval.util.AccessStrategy;
>>> -
>>>   import java.lang.annotation.ElementType;
>>>   import java.lang.reflect.Constructor;
>>>   import java.lang.reflect.Type;
>>> -import java.security.AccessController;
>>> -import java.security.PrivilegedAction;
>>> +
>>> +import org.apache.bval.util.AccessStrategy;
>>>
>>>   public class ConstructorAccess extends AccessStrategy {
>>>
>>> @@ -30,18 +28,7 @@ public class ConstructorAccess extends A
>>>
>>>       public ConstructorAccess(final Constructor<?> constructor) {
>>>           this.constructor = constructor;
>>> -        if (!constructor.isAccessible()) {
>>> -            if (System.getSecurityManager() == null) {
>>> -                constructor.setAccessible(true);
>>> -            } else {
>>> -                AccessController.doPrivileged(new
>>> PrivilegedAction<Void>() {
>>> -                    public Void run() {
>>> -                        constructor.setAccessible(true);
>>> -                        return null;
>>> -                    }
>>> -                });
>>> -            }
>>> -        }
>>> +        setAccessible(constructor);
>>>       }
>>>
>>>       @Override
>>>
>>> Modified:
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/model/MetaBean.java
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> core/src/main/java/org/apache/bval/model/MetaBean.java?rev=
>>> 1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> ---
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/model/MetaBean.java
>>> (original)
>>> +++
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/model/MetaBean.java
>>> Wed Oct  1 04:37:36 2014
>>> @@ -17,6 +17,8 @@
>>>   package org.apache.bval.model;
>>>
>>>   import org.apache.bval.util.reflection.Reflection;
>>> +import org.apache.commons.weaver.privilizer.Privilizing;
>>> +import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
>>>
>>>   import java.beans.Introspector;
>>>   import java.lang.reflect.Constructor;
>>> @@ -34,6 +36,7 @@ import java.util.TreeMap;
>>>    *
>>>    * @see MetaProperty
>>>    */
>>> +@Privilizing(@CallTo(Reflection.class))
>>>   public class MetaBean extends FeaturesCapable implements Cloneable,
>>> Features.Bean {
>>>       private static final long serialVersionUID = 2L;
>>>
>>> @@ -280,7 +283,7 @@ public class MetaBean extends FeaturesCa
>>>               int i = 0;
>>>               Class<?> clazz = beanClass;
>>>               while (clazz != null && clazz != Object.class) {
>>> -                for (final Field f :
>>> Reflection.INSTANCE.getDeclaredFields(clazz)) {
>>> +                for (final Field f : Reflection.getDeclaredFields(
>>> clazz))
>>> {
>>>                       i++;
>>>                       final String name = f.getName();
>>>                       if (!fields.containsKey(name)) {
>>> @@ -321,7 +324,7 @@ public class MetaBean extends FeaturesCa
>>>           protected MethodComparator(final Class<?> beanClass) {
>>>               Class<?> clazz = beanClass;
>>>               while (clazz != null && clazz != Object.class) {
>>> -                for (final Method m :
>>> Reflection.INSTANCE.getDeclaredMethods(clazz)) {
>>> +                for (final Method m :
>>> Reflection.getDeclaredMethods(clazz)) {
>>>                       methods.put(m,
>>> Arrays.hashCode(m.getParameterTypes()));
>>>                   }
>>>                   clazz = clazz.getSuperclass();
>>> @@ -345,7 +348,7 @@ public class MetaBean extends FeaturesCa
>>>           private final Map<Constructor<?>, Integer> constructors = new
>>> HashMap<Constructor<?>, Integer>();
>>>
>>>           protected ConstructorComparator(final Class<?> beanClass) {
>>> -            for (final Constructor<?> c :
>>> Reflection.INSTANCE.getDeclaredConstructors(beanClass)) {
>>> +            for (final Constructor<?> c :
>>> Reflection.getDeclaredConstructors(beanClass)) {
>>>                   constructors.put(c,
>>> Arrays.hashCode(c.getParameterTypes()));
>>>               }
>>>           }
>>>
>>> Modified:
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/AccessStrategy.java
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> core/src/main/java/org/apache/bval/util/AccessStrategy.java?
>>> rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> ---
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/AccessStrategy.java
>>> (original)
>>> +++
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/AccessStrategy.java
>>> Wed Oct  1 04:37:36 2014
>>> @@ -17,8 +17,11 @@
>>>   package org.apache.bval.util;
>>>
>>>   import java.lang.annotation.ElementType;
>>> +import java.lang.reflect.AccessibleObject;
>>>   import java.lang.reflect.Type;
>>>
>>> +import org.apache.commons.weaver.privilizer.Privileged;
>>> +
>>>   /**
>>>    * Description: abstract class to encapsulate different strategies
>>>    * to get the value of a Property.  This class is designed such that
>>> @@ -55,4 +58,21 @@ public abstract class AccessStrategy {
>>>        * @return String
>>>        */
>>>       public abstract String getPropertyName();
>>> +
>>> +    /**
>>> +     * Set {@code accessibleObject} as being accessible
>>> +     * @param accessibleObject
>>> +     */
>>> +    protected boolean setAccessible(AccessibleObject accessibleObject) {
>>> +        if (accessibleObject.isAccessible()) {
>>> +            return false;
>>> +        }
>>> +        doSetAccessible(accessibleObject);
>>> +        return true;
>>> +    }
>>> +
>>> +    @Privileged
>>> +    private void doSetAccessible(AccessibleObject accessibleObject) {
>>> +        accessibleObject.setAccessible(true);
>>> +    }
>>>   }
>>>
>>> Modified:
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/BValVersion.java
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> core/src/main/java/org/apache/bval/util/BValVersion.java?
>>> rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> ---
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/BValVersion.java
>>> (original)
>>> +++
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/BValVersion.java
>>> Wed Oct  1 04:37:36 2014
>>> @@ -18,18 +18,21 @@
>>>    */
>>>   package org.apache.bval.util;
>>>
>>> -import org.apache.bval.util.reflection.Reflection;
>>> -
>>>   import java.io.IOException;
>>>   import java.io.InputStream;
>>>   import java.util.Properties;
>>>   import java.util.StringTokenizer;
>>>
>>> +import org.apache.bval.util.reflection.Reflection;
>>> +import org.apache.commons.weaver.privilizer.Privilizing;
>>> +import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
>>> +
>>>   /**
>>>    * This class contains version information for BVal.
>>>    * It uses Ant's filter tokens to convert the template into a java
>>>    * file with current information.
>>>    */
>>> +@Privilizing(@CallTo(Reflection.class))
>>>   public class BValVersion {
>>>
>>>       /** Project name */
>>> @@ -157,7 +160,7 @@ public class BValVersion {
>>>        * {@inheritDoc}
>>>        */
>>>       public String toString() {
>>> -        StringBuilder buf = new StringBuilder(80 * 40);
>>> +        final StringBuilder buf = new StringBuilder(80 * 40);
>>>           appendBanner(buf);
>>>           buf.append("\n");
>>>
>>> @@ -169,8 +172,7 @@ public class BValVersion {
>>>           appendProperty("java.vendor", buf).append("\n\n");
>>>
>>>           buf.append("java.class.path:\n");
>>> -        StringTokenizer tok = new StringTokenizer(
>>> -            Reflection.INSTANCE.getProperty("java.class.path"));
>>> +        final StringTokenizer tok = new
>>> StringTokenizer(Reflection.getProperty("java.class.path"));
>>>           while (tok.hasMoreTokens()) {
>>>               buf.append("\t").append(tok.nextToken());
>>>               buf.append("\n");
>>> @@ -191,7 +193,6 @@ public class BValVersion {
>>>       }
>>>
>>>       private StringBuilder appendProperty(String prop, StringBuilder
>>> buf) {
>>> -        return buf.append(prop).append(": ").append(
>>> -            Reflection.INSTANCE.getProperty(prop));
>>> +        return buf.append(prop).append(":
>>> ").append(Reflection.getProperty(prop));
>>>       }
>>>   }
>>>
>>> Modified:
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/FieldAccess.java
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> core/src/main/java/org/apache/bval/util/FieldAccess.java?
>>> rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> ---
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/FieldAccess.java
>>> (original)
>>> +++
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/FieldAccess.java
>>> Wed Oct  1 04:37:36 2014
>>> @@ -19,8 +19,6 @@ package org.apache.bval.util;
>>>   import java.lang.annotation.ElementType;
>>>   import java.lang.reflect.Field;
>>>   import java.lang.reflect.Type;
>>> -import java.security.AccessController;
>>> -import java.security.PrivilegedAction;
>>>
>>>   /**
>>>    * Description: direct field access strategy.<br/>
>>> @@ -35,18 +33,7 @@ public class FieldAccess extends AccessS
>>>        */
>>>       public FieldAccess(final Field field) {
>>>           this.field = field;
>>> -        if (!field.isAccessible()) {
>>> -            if (System.getSecurityManager() == null) {
>>> -                field.setAccessible(true);
>>> -            } else {
>>> -                AccessController.doPrivileged(new
>>> PrivilegedAction<Void>() {
>>> -                    public Void run() {
>>> -                        field.setAccessible(true);
>>> -                        return null;
>>> -                    }
>>> -                });
>>> -            }
>>> -        }
>>> +        setAccessible(field);
>>>       }
>>>
>>>       /**
>>>
>>> Modified:
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/IndexedAccess.java
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> core/src/main/java/org/apache/bval/util/IndexedAccess.java?
>>> rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> ---
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/IndexedAccess.java
>>> (original)
>>> +++
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/IndexedAccess.java
>>> Wed Oct  1 04:37:36 2014
>>> @@ -16,6 +16,7 @@
>>>    */
>>>   package org.apache.bval.util;
>>>
>>> +import org.apache.commons.lang3.ObjectUtils;
>>>   import org.apache.commons.lang3.reflect.TypeUtils;
>>>
>>>   import java.lang.annotation.ElementType;
>>> @@ -28,7 +29,7 @@ import java.util.Map;
>>>   /**
>>>    * {@link AccessStrategy} to get an indexed member of an {@link
>>> Iterable}
>>> or
>>>    * array object.
>>> - */
>>> + */
>>>   public class IndexedAccess extends AccessStrategy {
>>>       private static final TypeVariable<?> ITERABLE_TYPE =
>>> Iterable.class.getTypeParameters()[0];
>>>
>>> @@ -45,13 +46,13 @@ public class IndexedAccess extends Acces
>>>           }
>>>           if (TypeUtils.isAssignable(containerType, Iterable.class)) {
>>>               Map<TypeVariable<?>, Type> typeArguments =
>>> TypeUtils.getTypeArguments(containerType, Iterable.class);
>>> -            return typeArguments.containsKey(ITERABLE_TYPE) ?
>>> typeArguments.get(ITERABLE_TYPE) : Object.class;
>>> +            return
>>> ObjectUtils.defaultIfNull(TypeUtils.unrollVariables(typeArguments,
>>> ITERABLE_TYPE), Object.class);
>>>           }
>>>           return null;
>>>       }
>>>
>>> -    private Type containerType;
>>> -    private Integer index;
>>> +    private final Type containerType;
>>> +    private final Integer index;
>>>
>>>       /**
>>>        * Create a new IndexedAccessStrategy instance.
>>>
>>> Modified:
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/KeyedAccess.java
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> core/src/main/java/org/apache/bval/util/KeyedAccess.java?
>>> rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> ---
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/KeyedAccess.java
>>> (original)
>>> +++
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/KeyedAccess.java
>>> Wed Oct  1 04:37:36 2014
>>> @@ -16,6 +16,7 @@
>>>    */
>>>   package org.apache.bval.util;
>>>
>>> +import org.apache.commons.lang3.ObjectUtils;
>>>   import org.apache.commons.lang3.reflect.TypeUtils;
>>>
>>>   import java.lang.annotation.ElementType;
>>> @@ -43,13 +44,13 @@ public class KeyedAccess extends AccessS
>>>       public static Type getJavaElementType(Type containerType) {
>>>           if (TypeUtils.isAssignable(containerType, Map.class)) {
>>>               Map<TypeVariable<?>, Type> typeArguments =
>>> TypeUtils.getTypeArguments(containerType, Map.class);
>>> -            return typeArguments.containsKey(MAP_TYPEVARS[1]) ?
>>> typeArguments.get(MAP_TYPEVARS[1]) : Object.class;
>>> +            return
>>> ObjectUtils.defaultIfNull(TypeUtils.unrollVariables(typeArguments,
>>> MAP_TYPEVARS[1]), Object.class);
>>>           }
>>>           return null;
>>>       }
>>>
>>> -    private Type containerType;
>>> -    private Object key;
>>> +    private final Type containerType;
>>> +    private final Object key;
>>>
>>>       /**
>>>        * Create a new KeyedAccess instance.
>>> @@ -71,7 +72,7 @@ public class KeyedAccess extends AccessS
>>>           if (instance instanceof Map<?, ?>) {
>>>               Map<?, ?> map = (Map<?, ?>) instance;
>>>               Map<TypeVariable<?>, Type> typeArguments =
>>> TypeUtils.getTypeArguments(containerType, Map.class);
>>> -            Type keyType = typeArguments.get(MAP_TYPEVARS[0]);
>>> +            Type keyType = TypeUtils.unrollVariables(typeArguments,
>>> MAP_TYPEVARS[0]);
>>>               if (key == null || keyType == null ||
>>> TypeUtils.isInstance(key, keyType)) {
>>>                   return map.get(key);
>>>               }
>>> @@ -106,7 +107,7 @@ public class KeyedAccess extends AccessS
>>>        */
>>>       @Override
>>>       public Type getJavaType() {
>>> -        Type result = getJavaElementType(containerType);
>>> +        final Type result = getJavaElementType(containerType);
>>>           return result == null ? Object.class : result;
>>>       }
>>>
>>>
>>> Modified:
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/MethodAccess.java
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> core/src/main/java/org/apache/bval/util/MethodAccess.java?
>>> rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> ---
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/MethodAccess.java
>>> (original)
>>> +++
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/MethodAccess.java
>>> Wed Oct  1 04:37:36 2014
>>> @@ -21,8 +21,6 @@ import java.lang.annotation.ElementType;
>>>   import java.lang.reflect.InvocationTargetException;
>>>   import java.lang.reflect.Method;
>>>   import java.lang.reflect.Type;
>>> -import java.security.AccessController;
>>> -import java.security.PrivilegedAction;
>>>
>>>   /**
>>>    * Description: invoke a zero-argument method (getter)<br/>
>>> @@ -47,18 +45,7 @@ public class MethodAccess extends Access
>>>       public MethodAccess(String propertyName, final Method method) {
>>>           this.method = method;
>>>           this.propertyName = propertyName;
>>> -        if (!method.isAccessible()) {
>>> -            if (System.getSecurityManager() == null) {
>>> -                method.setAccessible(true);
>>> -            } else {
>>> -                AccessController.doPrivileged(new
>>> PrivilegedAction<Void>() {
>>> -                    public Void run() {
>>> -                        method.setAccessible(true);
>>> -                        return null;
>>> -                    }
>>> -                });
>>> -            }
>>> -        }
>>> +        setAccessible(method);
>>>       }
>>>
>>>       /**
>>> @@ -69,21 +56,14 @@ public class MethodAccess extends Access
>>>        *         the method name id not according to the JavaBeans
>>> standard.
>>>        */
>>>       public static String getPropertyName(Method member) {
>>> -        String name = null;
>>> -        String methodName = member.getName();
>>> +        final String methodName = member.getName();
>>>           if (methodName.startsWith("is")) {
>>> -            name = Introspector.decapitalize(methodName.substring(2));
>>> -        } /* else if ( methodName.startsWith("has")) {
>>> -                               name = Introspector.decapitalize(
>>> methodName.substring( 3 ) );
>>> -                       } */
>>> -        // setter annotation is NOT supported in the spec
>>> -        /*  else if (method.getName().startsWith("set") &&
>>> method.getParameterTypes().length == 1) {
>>> -           propName =
>>> Introspector.decapitalize(method.getName().substring(3));
>>> -       } */
>>> -        else if (methodName.startsWith("get")) {
>>> -            name = Introspector.decapitalize(methodName.substring(3));
>>> +            return Introspector.decapitalize(methodName.substring(2));
>>> +        }
>>> +        if (methodName.startsWith("get")) {
>>> +            return Introspector.decapitalize(methodName.substring(3));
>>>           }
>>> -        return name;
>>> +        return null;
>>>       }
>>>
>>>       /**
>>>
>>> Modified:
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/reflection/Reflection.java
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> core/src/main/java/org/apache/bval/util/reflection/
>>> Reflection.java?rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> ---
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/reflection/Reflection.java
>>> (original)
>>> +++
>>> bval/branches/bval-11/bval-core/src/main/java/org/apache/
>>> bval/util/reflection/Reflection.java
>>> Wed Oct  1 04:37:36 2014
>>> @@ -21,44 +21,122 @@ 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;
>>>
>>> -public interface Reflection {
>>> -    static final Reflection INSTANCE = ReflectionFactory.newInstance();
>>> +import org.apache.commons.lang3.ClassUtils;
>>>
>>> -    Class<?> getClass(final ClassLoader classLoader, final String
>>> className) throws Exception;
>>> -
>>> -    Object getAnnotationValue(final Annotation annotation, final
>>> String name) throws IllegalAccessException, InvocationTargetException;
>>> +/**
>>> + * Security-agnostic "blueprint" class for reflection-related
>>> operations.
>>> + *
>>> + * @version $Rev$ $Date$
>>> + */
>>> +public class Reflection {
>>> +
>>> +    private static void setAccessibility(final Field field) {
>>> +        // FIXME 2011-03-27 jw:
>>> +        // - Why not simply call field.setAccessible(true)?
>>> +        // - Fields can not be abstract.
>>> +        if (!Modifier.isPublic(field.getModifiers())
>>> +            || (Modifier.isPublic(field.getModifiers()) &&
>>> Modifier.isAbstract(field.getModifiers()))) {
>>> +            field.setAccessible(true);
>>> +        }
>>> +    }
>>>
>>> -    ClassLoader getClassLoader(final Class<?> clazz);
>>> +    public static Class<?> getClass(final ClassLoader classLoader,
>>> final String className) throws Exception {
>>> +        return ClassUtils.getClass(classLoader, className, true);
>>> +    }
>>>
>>> -    String getProperty(final String name);
>>> +    public static Object getAnnotationValue(final Annotation
>>> annotation, final String name)
>>> +        throws IllegalAccessException, InvocationTargetException {
>>> +        Method valueMethod;
>>> +        try {
>>> +            valueMethod =
>>> annotation.annotationType().getDeclaredMethod(name);
>>> +        } catch (final NoSuchMethodException ex) {
>>> +            // do nothing
>>> +            valueMethod = null;
>>> +        }
>>> +        if (null != valueMethod) {
>>> +            if (!valueMethod.isAccessible()) {
>>> +                valueMethod.setAccessible(true);
>>> +            }
>>> +            return valueMethod.invoke(annotation);
>>> +        }
>>> +        return null;
>>> +    }
>>>
>>> -    Field getDeclaredField(final Class<?> clazz, final String
>>> fieldName);
>>> +    public static ClassLoader getClassLoader(final Class<?> clazz) {
>>> +        final ClassLoader cl =
>>> Thread.currentThread().getContextClassLoader();
>>> +        if (cl != null) {
>>> +            return cl;
>>> +        }
>>> +        return clazz.getClassLoader();
>>> +    }
>>>
>>> -    Field[] getDeclaredFields(final Class<?> clazz);
>>> +    public static String getProperty(final String name) {
>>> +        return System.getProperty(name);
>>> +    }
>>>
>>> -    Constructor<?> getDeclaredConstructor(final Class<?> clazz, final
>>> Class<?>... parameters);
>>> +    public static Field getDeclaredField(final Class<?> clazz, final
>>> String fieldName) {
>>> +        final Field f;
>>> +        try {
>>> +            f = clazz.getDeclaredField(fieldName);
>>> +        } catch (final NoSuchFieldException e) {
>>> +            return null;
>>> +        }
>>> +        setAccessibility(f);
>>> +        return f;
>>> +    }
>>>
>>> -    Method getDeclaredMethod(final Class<?> clazz, final String name,
>>> final Class<?>... parameters);
>>> +    public static Field[] getDeclaredFields(final Class<?> clazz) {
>>> +        final Field[] fields = clazz.getDeclaredFields();
>>> +        if (fields.length > 0) {
>>> +            for (final Field f : fields) {
>>> +                if (!f.isAccessible()) {
>>> +                    f.setAccessible(true);
>>> +                }
>>> +            }
>>> +        }
>>> +        return fields;
>>> +    }
>>>
>>> -    Method[] getDeclaredMethods(final Class<?> clazz);
>>> +    public static Constructor<?> getDeclaredConstructor(final
>>> Class<?> clazz, final Class<?>... parameters) {
>>> +        try {
>>> +            return clazz.getDeclaredConstructor(parameters);
>>> +        } catch (final NoSuchMethodException e) {
>>> +            return null;
>>> +        }
>>> +    }
>>>
>>> -    Constructor<?>[] getDeclaredConstructors(final Class<?> clazz);
>>> +    public static Method getDeclaredMethod(final Class<?> clazz,
>>> final String name, final Class<?>... parameters) {
>>> +        try {
>>> +            return clazz.getDeclaredMethod(name, parameters);
>>> +        } catch (final NoSuchMethodException e) {
>>> +            return null;
>>> +        }
>>> +    }
>>>
>>> -    Method getPublicMethod(final Class<?> clazz, final String
>>> methodName);
>>> +    public static Method[] getDeclaredMethods(final Class<?> clazz) {
>>> +        return clazz.getDeclaredMethods();
>>> +    }
>>>
>>> -    <T> T newInstance(final Class<T> cls);
>>> +    public static Constructor<?>[] getDeclaredConstructors(final
>>> Class<?> clazz) {
>>> +        return clazz.getDeclaredConstructors();
>>> +    }
>>>
>>> -    public static class ReflectionFactory {
>>> -        public static Reflection newInstance() {
>>> -            if (System.getSecurityManager() != null) {
>>> -                return new SecurityManagerReflection();
>>> -            }
>>> -            return new DefaultReflection();
>>> +    public static Method getPublicMethod(final Class<?> clazz, final
>>> String methodName) {
>>> +        try {
>>> +            return clazz.getMethod(methodName);
>>> +        } catch (final NoSuchMethodException e) {
>>> +            return null;
>>>           }
>>> +    }
>>>
>>> -        private ReflectionFactory() {
>>> -            // no-op
>>> +    public static <T> T newInstance(final Class<T> cls) {
>>> +        try {
>>> +            return cls.newInstance();
>>> +        } catch (final Exception ex) {
>>> +            throw new RuntimeException("Cannot instantiate : " + cls,
>>> ex);
>>>           }
>>>       }
>>> +
>>>   }
>>>
>>> Propchange: bval/branches/bval-11/bval-jsr/
>>>
>>> ------------------------------------------------------------
>>> ------------------
>>> --- svn:ignore (added)
>>> +++ svn:ignore Wed Oct  1 04:37:36 2014
>>> @@ -0,0 +1,4 @@
>>> +.classpath
>>> +.project
>>> +.settings
>>> +target
>>>
>>> Propchange: bval/branches/bval-11/bval-jsr/
>>>
>>> ------------------------------------------------------------
>>> ------------------
>>> --- svn:mergeinfo (added)
>>> +++ svn:mergeinfo Wed Oct  1 04:37:36 2014
>>> @@ -0,0 +1,2 @@
>>> +/bval/trunk/bval-jsr303:1598345
>>> +/incubator/bval/sandbox/lang3-work/bval-jsr:992137-1166425
>>>
>>> Modified: bval/branches/bval-11/bval-jsr/pom.xml
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> jsr/pom.xml?rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> --- bval/branches/bval-11/bval-jsr/pom.xml (original)
>>> +++ bval/branches/bval-11/bval-jsr/pom.xml Wed Oct  1 04:37:36 2014
>>> @@ -79,13 +79,73 @@
>>>                   <plugins>
>>>                       <plugin>
>>>                           <groupId>org.apache.maven.plugins</groupId>
>>> +                        <artifactId>maven-resources-plugin</artifactId>
>>> +                        <executions>
>>> +                            <execution>
>>> +                                <id>default-testResources</id>
>>> +                                <phase />
>>> +                                <goals>
>>> +                                    <goal>testResources</goal>
>>> +                                </goals>
>>> +                            </execution>
>>> +                        </executions>
>>> +                    </plugin>
>>> +                    <plugin>
>>> +                        <groupId>org.apache.maven.plugins</groupId>
>>> +                        <artifactId>maven-antrun-plugin</artifactId>
>>> +                        <executions>
>>> +                            <execution>
>>> +                                <id>filter-testResources</id>
>>> +                                <phase>process-test-resources</phase>
>>> +                                <goals>
>>> +                                    <goal>run</goal>
>>> +                                </goals>
>>> +                                <configuration>
>>> +                                    <target>
>>> +                                        <mkdir
>>> dir="${project.build.testOutputDirectory}" />
>>> +                                        <condition property="slash"
>>> value="/" else="">
>>> +                                            <os family="windows" />
>>> +                                        </condition>
>>> +                                        <copy
>>> todir="${project.build.testOutputDirectory}" overwrite="true">
>>> +                                            <fileset
>>> dir="${project.basedir}/src/test/resources" excludes="java.policy" />
>>> +                                        </copy>
>>> +                                        <copy
>>> todir="${project.build.testOutputDirectory}" overwrite="true">
>>> +                                            <fileset
>>> file="${project.basedir}/src/test/resources/java.policy" />
>>> +                                            <filterchain>
>>> +                                                <expandproperties />
>>> +                                                <!-- append extra
>>> slash on windows only -->
>>> +                                                <replacestring
>>> from="file://" to="file://${slash}" />
>>> +                                                <replacestring
>>> from="${file.separator}" to="/" />
>>> +                                                <!-- preserve
>>> system-specific file separator -->
>>> +                                                <expandproperties>
>>> +                                                    <propertyset>
>>> +                                                        <propertyref
>>> prefix="project." />
>>> +                                                        <globmapper
>>> from="*" to="preserve.*" />
>>> +                                                    </propertyset>
>>> +                                                </expandproperties>
>>> +                                            </filterchain>
>>> +                                        </copy>
>>> +                                    </target>
>>> +                                </configuration>
>>> +                            </execution>
>>> +                        </executions>
>>> +                        <dependencies>
>>> +                            <dependency>
>>> +                                <groupId>org.apache.ant</groupId>
>>> +                                <artifactId>ant</artifactId>
>>> +                                <version>1.9.3</version>
>>> +                            </dependency>
>>> +                        </dependencies>
>>> +                    </plugin>
>>> +                    <plugin>
>>> +                        <groupId>org.apache.maven.plugins</groupId>
>>>                           <artifactId>maven-surefire-plugin</artifactId>
>>>                           <configuration>
>>>                               <includes>
>>>                                   <include>**/*Test.java</include>
>>>                                   <include>**/*TestCase.java</include>
>>>                               </includes>
>>> -                            <argLine>-Djava.security.manager
>>>
>>> -Djava.security.policy=${project.basedir}/src/test/
>>> resources/java.policy</argLine>
>>> +                            <argLine>-Djava.security.manager
>>>
>>> -Djava.security.policy=${project.build.testOutputDirectory}/java.
>>> policy</argLine>
>>>                           </configuration>
>>>                       </plugin>
>>>                   </plugins>
>>> @@ -103,6 +163,10 @@
>>>               <groupId>org.apache.commons</groupId>
>>>               <artifactId>commons-lang3</artifactId>
>>>           </dependency>
>>> +        <dependency>
>>> +            <groupId>org.apache.commons</groupId>
>>> +            <artifactId>commons-weaver-privilizer-api</artifactId>
>>> +        </dependency>
>>>           <!-- optional dependencies -->
>>>           <dependency>
>>>               <groupId>org.apache.bval</groupId>
>>> @@ -235,6 +299,10 @@
>>>                       </includes>
>>>                   </configuration>
>>>               </plugin>
>>> +            <plugin>
>>> +                <groupId>org.apache.commons</groupId>
>>> +                <artifactId>commons-weaver-maven-plugin</artifactId>
>>> +            </plugin>
>>>           </plugins>
>>>       </build>
>>>   </project>
>>>
>>> Modified:
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> AnnotationConstraintBuilder.java
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> jsr/src/main/java/org/apache/bval/jsr/AnnotationConstraintBuilder.
>>> java?rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> ---
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> AnnotationConstraintBuilder.java
>>> (original)
>>> +++
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> AnnotationConstraintBuilder.java
>>> Wed Oct  1 04:37:36 2014
>>> @@ -18,27 +18,9 @@
>>>    */
>>>   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.commons.lang3.reflect.TypeUtils;
>>> -
>>> -import javax.validation.Constraint;
>>> -import javax.validation.ConstraintDeclarationException;
>>> -import javax.validation.ConstraintDefinitionException;
>>> -import javax.validation.ConstraintTarget;
>>> -import javax.validation.ConstraintValidator;
>>> -import javax.validation.ConstraintValidatorFactory;
>>> -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.security.AccessController;
>>> -import java.security.PrivilegedAction;
>>>   import java.util.Arrays;
>>>   import java.util.Collections;
>>>   import java.util.HashMap;
>>> @@ -50,6 +32,24 @@ import java.util.Set;
>>>   import java.util.logging.Level;
>>>   import java.util.logging.Logger;
>>>
>>> +import javax.validation.Constraint;
>>> +import javax.validation.ConstraintDeclarationException;
>>> +import javax.validation.ConstraintDefinitionException;
>>> +import javax.validation.ConstraintTarget;
>>> +import javax.validation.ConstraintValidator;
>>> +import javax.validation.ConstraintValidatorFactory;
>>> +import javax.validation.OverridesAttribute;
>>> +import javax.validation.Payload;
>>> +import javax.validation.ReportAsSingleViolation;
>>> +import javax.validation.constraintvalidation.SupportedValidationTarget;
>>> +import javax.validation.constraintvalidation.ValidationTarget;
>>> +
>>> +import org.apache.bval.jsr.groups.GroupsComputer;
>>> +import org.apache.bval.jsr.xml.AnnotationProxyBuilder;
>>> +import org.apache.bval.util.AccessStrategy;
>>> +import org.apache.commons.lang3.reflect.TypeUtils;
>>> +import org.apache.commons.weaver.privilizer.Privileged;
>>> +
>>>   /**
>>>    * Description: helper class that builds a {@link ConstraintValidation}
>>> or its
>>>    * composite constraint validations by parsing the jsr-annotations and
>>> @@ -78,22 +78,11 @@ final class AnnotationConstraintBuilder<
>>>       }
>>>
>>>       /** build attributes, payload, groups from 'annotation' */
>>> +    @Privileged
>>>       private void buildFromAnnotation() {
>>> -        if (constraintValidation.getAnnotation() != null) {
>>> -            if (System.getSecurityManager() == null) {
>>> -                doBuildFromAnnotations();
>>> -            } else {
>>> -                AccessController.doPrivileged(new
>>> PrivilegedAction<Object>() {
>>> -                    public Object run() {
>>> -                        doBuildFromAnnotations();
>>> -                        return null;
>>> -                    }
>>> -                });
>>> -            }
>>> +        if (constraintValidation.getAnnotation() == null) {
>>> +            return;
>>>           }
>>> -    }
>>> -
>>> -    private void doBuildFromAnnotations() {
>>>           final Class<? extends Annotation> annotationType =
>>> constraintValidation.getAnnotation().annotationType();
>>>
>>>           boolean foundPayload = false;
>>>
>>> Modified:
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/AnnotationProcessor.java
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> jsr/src/main/java/org/apache/bval/jsr/AnnotationProcessor.
>>> java?rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> ---
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/AnnotationProcessor.java
>>> (original)
>>> +++
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/AnnotationProcessor.java
>>> Wed Oct  1 04:37:36 2014
>>> @@ -24,6 +24,8 @@ import org.apache.bval.model.MetaBean;
>>>   import org.apache.bval.util.AccessStrategy;
>>>   import org.apache.bval.util.reflection.Reflection;
>>>   import org.apache.commons.lang3.ArrayUtils;
>>> +import org.apache.commons.weaver.privilizer.Privilizing;
>>> +import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
>>>
>>>   import javax.validation.Constraint;
>>>   import javax.validation.ConstraintValidator;
>>> @@ -32,6 +34,7 @@ import javax.validation.constraintvalida
>>>   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;
>>> @@ -44,6 +47,7 @@ import java.util.Set;
>>>    * annotations, including composed constraints and the resolution of
>>>    * {@link ConstraintValidator} implementations.
>>>    */
>>> +@Privilizing(@CallTo(Reflection.class))
>>>   public final class AnnotationProcessor {
>>>       /** {@link ApacheFactoryContext} used */
>>>       private final ApacheFactoryContext factoryContext;
>>> @@ -142,7 +146,8 @@ public final class AnnotationProcessor {
>>>            * annotated by @Constraint) whose value element has a return
>>> type of an
>>>            * array of constraint annotations in a special way.
>>>            */
>>> -        final Object result =
>>> Reflection.INSTANCE.getAnnotationValue(annotation,
>>> ConstraintAnnotationAttributes.VALUE.getAttributeName());
>>> +        final Object result =
>>> +            Reflection.getAnnotationValue(annotation,
>>> ConstraintAnnotationAttributes.VALUE.getAttributeName());
>>>           if (result instanceof Annotation[]) {
>>>               boolean changed = false;
>>>               for (final Annotation each : (Annotation[]) result) {
>>>
>>> Modified:
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/ApacheFactoryContext.java
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.
>>> java?rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> ---
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/ApacheFactoryContext.java
>>> (original)
>>> +++
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/ApacheFactoryContext.java
>>> Wed Oct  1 04:37:36 2014
>>> @@ -18,6 +18,18 @@
>>>    */
>>>   package org.apache.bval.jsr;
>>>
>>> +import java.lang.reflect.Constructor;
>>> +import java.util.ArrayList;
>>> +import java.util.List;
>>> +
>>> +import javax.validation.ConstraintValidatorFactory;
>>> +import javax.validation.MessageInterpolator;
>>> +import javax.validation.ParameterNameProvider;
>>> +import javax.validation.TraversableResolver;
>>> +import javax.validation.ValidationException;
>>> +import javax.validation.Validator;
>>> +import javax.validation.ValidatorContext;
>>> +
>>>   import org.apache.bval.IntrospectorMetaBeanFactory;
>>>   import org.apache.bval.MetaBeanBuilder;
>>>   import org.apache.bval.MetaBeanFactory;
>>> @@ -29,24 +41,15 @@ import org.apache.bval.xml.XMLMetaBeanFa
>>>   import org.apache.bval.xml.XMLMetaBeanManager;
>>>   import org.apache.commons.lang3.StringUtils;
>>>   import org.apache.commons.lang3.reflect.ConstructorUtils;
>>> -
>>> -import javax.validation.ConstraintValidatorFactory;
>>> -import javax.validation.MessageInterpolator;
>>> -import javax.validation.ParameterNameProvider;
>>> -import javax.validation.TraversableResolver;
>>> -import javax.validation.ValidationException;
>>> -import javax.validation.Validator;
>>> -import javax.validation.ValidatorContext;
>>> -import java.lang.reflect.Constructor;
>>> -import java.security.AccessController;
>>> -import java.security.PrivilegedAction;
>>> -import java.util.ArrayList;
>>> -import java.util.List;
>>> +import org.apache.commons.weaver.privilizer.Privileged;
>>> +import org.apache.commons.weaver.privilizer.Privilizing;
>>> +import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
>>>
>>>   /**
>>>    * Description: Represents the context that is used to create
>>>    * <code>ClassValidator</code> instances.<br/>
>>>    */
>>> +@Privilizing(@CallTo(Reflection.class))
>>>   public class ApacheFactoryContext implements ValidatorContext {
>>>       private final ApacheValidatorFactory factory;
>>>       private final MetaBeanFinder metaBeanFinder;
>>> @@ -238,18 +241,8 @@ public class ApacheFactoryContext implem
>>>           return new MetaBeanManager(new
>>> MetaBeanBuilder(builders.toArray(new
>>> MetaBeanFactory[builders.size()])));
>>>       }
>>>
>>> +    @Privileged
>>>       private <F extends MetaBeanFactory> F createMetaBeanFactory(final
>>> Class<F> cls) {
>>> -        if (System.getSecurityManager() == null) {
>>> -            return doCreateMetaBeanFactory(cls);
>>> -        }
>>> -        return AccessController.doPrivileged(new PrivilegedAction<F>()
>>> {
>>> -            public F run() {
>>> -                return doCreateMetaBeanFactory(cls);
>>> -            }
>>> -        });
>>> -    }
>>> -
>>> -    private <F extends MetaBeanFactory> F
>>> doCreateMetaBeanFactory(final Class<F> cls) {
>>>           try {
>>>               Constructor<F> c =
>>> ConstructorUtils.getMatchingAccessibleConstructor(cls,
>>> ApacheFactoryContext.this.getClass());
>>>               if (c != null) {
>>> @@ -294,7 +287,7 @@ public class ApacheFactoryContext implem
>>>
>>>       private Class<?> loadClass(final String className) {
>>>           try {
>>> -            return Class.forName(className, true,
>>> Reflection.INSTANCE.getClassLoader(ApacheFactoryContext.class));
>>> +            return Class.forName(className, true,
>>> Reflection.getClassLoader(ApacheFactoryContext.class));
>>>           } catch (ClassNotFoundException ex) {
>>>               throw new ValidationException("Unable to load class: " +
>>> className, ex);
>>>           }
>>>
>>> Modified:
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> ApacheValidationProvider.java
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> jsr/src/main/java/org/apache/bval/jsr/ApacheValidationProvider.java?
>>> rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> ---
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> ApacheValidationProvider.java
>>> (original)
>>> +++
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> ApacheValidationProvider.java
>>> Wed Oct  1 04:37:36 2014
>>> @@ -18,16 +18,15 @@
>>>    */
>>>   package org.apache.bval.jsr;
>>>
>>> -import org.apache.commons.lang3.ClassUtils;
>>> -
>>>   import javax.validation.Configuration;
>>>   import javax.validation.ValidationException;
>>>   import javax.validation.ValidatorFactory;
>>>   import javax.validation.spi.BootstrapState;
>>>   import javax.validation.spi.ConfigurationState;
>>>   import javax.validation.spi.ValidationProvider;
>>> -import java.security.AccessController;
>>> -import java.security.PrivilegedAction;
>>> +
>>> +import org.apache.commons.lang3.ClassUtils;
>>> +import org.apache.commons.weaver.privilizer.Privileged;
>>>
>>>   /**
>>>    * Description: Implementation of {@link ValidationProvider} for jsr
>>> @@ -98,15 +97,10 @@ public class ApacheValidationProvider im
>>>           // No privileges should be required to access the constructor,
>>>           // because the classloader of ApacheValidationProvider will
>>> always
>>>           // be an ancestor of the loader of validatorFactoryClass.
>>> -        return (System.getSecurityManager() == null)
>>> -            ? instantiateValidatorFactory(validatorFactoryClass,
>>> configuration) : AccessController
>>> -                .doPrivileged(new PrivilegedAction<ValidatorFactory>()
>>> {
>>> -                    public ValidatorFactory run() {
>>> -                        return
>>> instantiateValidatorFactory(validatorFactoryClass, configuration);
>>> -                    }
>>> -                });
>>> +        return instantiateValidatorFactory(validatorFactoryClass,
>>> configuration);
>>>       }
>>>
>>> +    @Privileged
>>>       private static ValidatorFactory instantiateValidatorFactory(
>>>           final Class<? extends ValidatorFactory>
>>> validatorFactoryClass, final ConfigurationState configuration) {
>>>           try {
>>>
>>> Modified:
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> ApacheValidatorConfiguration.java
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorConfiguration.
>>> java?rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> ---
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> ApacheValidatorConfiguration.java
>>> (original)
>>> +++
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> ApacheValidatorConfiguration.java
>>> Wed Oct  1 04:37:36 2014
>>> @@ -72,7 +72,7 @@ public interface ApacheValidatorConfigur
>>>            * class is presumed have a constructor that accepts a single
>>>            * {@link ConfigurationState} argument.
>>>            */
>>> -         String VALIDATOR_FACTORY_CLASSNAME =
>>> "apache.bval.validator-factory-classname";
>>> +        String VALIDATOR_FACTORY_CLASSNAME =
>>> "apache.bval.validator-factory-classname";
>>>
>>>           /**
>>>            * Specifies the names, delimited by whitespace, of
>>> @@ -86,6 +86,6 @@ public interface ApacheValidatorConfigur
>>>            * <li>default (no-args) constructor</li>
>>>            * </ol>
>>>            */
>>> -         String METABEAN_FACTORY_CLASSNAMES =
>>> "apache.bval.metabean-factory-classnames";
>>> +        String METABEAN_FACTORY_CLASSNAMES =
>>> "apache.bval.metabean-factory-classnames";
>>>       }
>>>   }
>>>
>>> Modified:
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> ApacheValidatorFactory.java
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorFactory.java?
>>> rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> ---
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> ApacheValidatorFactory.java
>>> (original)
>>> +++
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/jsr/
>>> ApacheValidatorFactory.java
>>> Wed Oct  1 04:37:36 2014
>>> @@ -25,6 +25,8 @@ import org.apache.bval.util.AccessStrate
>>>   import org.apache.bval.util.reflection.Reflection;
>>>   import org.apache.commons.lang3.ArrayUtils;
>>>   import org.apache.commons.lang3.ClassUtils;
>>> +import org.apache.commons.weaver.privilizer.Privilizing;
>>> +import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
>>>
>>>   import javax.validation.ConstraintValidatorFactory;
>>>   import javax.validation.MessageInterpolator;
>>> @@ -35,6 +37,7 @@ import javax.validation.ValidationExcept
>>>   import javax.validation.Validator;
>>>   import javax.validation.ValidatorFactory;
>>>   import javax.validation.spi.ConfigurationState;
>>> +
>>>   import java.io.Closeable;
>>>   import java.lang.annotation.Annotation;
>>>   import java.lang.reflect.Modifier;
>>> @@ -52,6 +55,7 @@ import java.util.concurrent.ConcurrentMa
>>>    * validators.<br/>
>>>    * This instance is not thread-safe.<br/>
>>>    */
>>> +@Privilizing(@CallTo(Reflection.class))
>>>   public class ApacheValidatorFactory implements ValidatorFactory,
>>> Cloneable {
>>>       private static volatile ApacheValidatorFactory DEFAULT_FACTORY;
>>>       private static final ConstraintDefaults DEFAULT_CONSTRAINTS = new
>>> ConstraintDefaults();
>>> @@ -295,7 +299,7 @@ public class ApacheValidatorFactory impl
>>>
>>>       private <T> T newInstance(final Class<T> cls) {
>>>           try {
>>> -            return Reflection.INSTANCE.newInstance(cls);
>>> +            return Reflection.newInstance(cls);
>>>           } catch (final RuntimeException e) {
>>>               throw new ValidationException(e.getCause());
>>>           }
>>>
>>> Modified:
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/BeanDescriptorImpl.java
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> jsr/src/main/java/org/apache/bval/jsr/BeanDescriptorImpl.
>>> java?rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> ---
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/BeanDescriptorImpl.java
>>> (original)
>>> +++
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/BeanDescriptorImpl.java
>>> Wed Oct  1 04:37:36 2014
>>> @@ -33,6 +33,8 @@ import org.apache.bval.model.Validation;
>>>   import org.apache.bval.util.AccessStrategy;
>>>   import org.apache.bval.util.reflection.Reflection;
>>>   import org.apache.commons.lang3.ClassUtils;
>>> +import org.apache.commons.weaver.privilizer.Privilizing;
>>> +import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
>>>
>>>   import javax.validation.Constraint;
>>>   import javax.validation.ConstraintDeclarationException;
>>> @@ -49,6 +51,7 @@ import javax.validation.metadata.MethodT
>>>   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;
>>> @@ -72,6 +75,7 @@ import java.util.concurrent.CopyOnWriteA
>>>   /**
>>>    * 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];
>>> @@ -120,7 +124,7 @@ public class BeanDescriptorImpl extends
>>>           Class<?> current = prop.getParentMetaBean().getBeanClass();
>>>           while (current != null && current != Object.class &&
>>> (!methodFound || !fieldFound)) {
>>>               if (!fieldFound) {
>>> -                final Field field =
>>> Reflection.INSTANCE.getDeclaredField(current, prop.getName());
>>> +                final Field field =
>>> Reflection.getDeclaredField(current, prop.getName());
>>>                   if (field != null) {
>>>                       processConvertGroup(edesc, field);
>>>                       fieldFound = true;
>>> @@ -129,12 +133,12 @@ public class BeanDescriptorImpl extends
>>>
>>>               if (!methodFound) {
>>>                   final String name =
>>> Character.toUpperCase(prop.getName().charAt(0)) +
>>> prop.getName().substring(1);
>>> -                Method m =
>>> Reflection.INSTANCE.getDeclaredMethod(current, "get" + name);
>>> +                Method m = Reflection.getDeclaredMethod(current, "get"
>>> +
>>> name);
>>>                   if (m != null) {
>>>                       processConvertGroup(edesc, m);
>>>                       methodFound = true;
>>>                   } else {
>>> -                    m =
>>> Reflection.INSTANCE.getDeclaredMethod(current, "is" + name);
>>> +                    m = Reflection.getDeclaredMethod(current, "is" +
>>> name);
>>>                       if (m != null) {
>>>                           processConvertGroup(edesc, m);
>>>                           methodFound = true;
>>> @@ -359,7 +363,7 @@ public class BeanDescriptorImpl extends
>>>           }
>>>
>>>           private void buildConstructorConstraints() throws
>>> InvocationTargetException, IllegalAccessException {
>>> -            for (final Constructor<?> cons :
>>> Reflection.INSTANCE.getDeclaredConstructors(metaBean.getBeanClass()))
>>> {
>>> +            for (final Constructor<?> cons :
>>> Reflection.getDeclaredConstructors(metaBean.getBeanClass())) {
>>>                   final ConstructorDescriptorImpl consDesc = new
>>> ConstructorDescriptorImpl(metaBean, EMPTY_VALIDATION);
>>>
>>> contructorConstraints.put(Arrays.toString(cons.getParameterTypes()),
>>> consDesc);
>>>
>>> @@ -500,7 +504,7 @@ public class BeanDescriptorImpl extends
>>>               final List<Class<?>> classHierarchy =
>>> ClassHelper.fillFullClassHierarchyAsList(new ArrayList<Class<?>>(),
>>> current);
>>>               classHierarchy.remove(current);
>>>
>>> -            for (final Method method :
>>> Reflection.INSTANCE.getDeclaredMethods(current)) {
>>> +            for (final Method method :
>>> Reflection.getDeclaredMethods(current)) {
>>>                   if (Modifier.isStatic(method.getModifiers()) ||
>>> method.isSynthetic()) {
>>>                       continue;
>>>                   }
>>> @@ -518,10 +522,10 @@ public class BeanDescriptorImpl extends
>>>
>>>                   final Collection<Method> parents = new
>>> ArrayList<Method>();
>>>                   for (final Class<?> clazz : classHierarchy) {
>>> -                    final Method overriden =
>>> Reflection.INSTANCE.getDeclaredMethod(clazz, method.getName(),
>>> method.getParameterTypes());
>>> -                    if (overriden != null) {
>>> -                        parents.add(overriden);
>>> -                        processMethod(overriden, methodDesc);
>>> +                    final Method overridden =
>>> Reflection.getDeclaredMethod(clazz, method.getName(),
>>> method.getParameterTypes());
>>> +                    if (overridden != null) {
>>> +                        parents.add(overridden);
>>> +                        processMethod(overridden, methodDesc);
>>>                       }
>>>                   }
>>>
>>> @@ -564,7 +568,7 @@ public class BeanDescriptorImpl extends
>>>                       final Class<?>[] interfaces =
>>> method.getDeclaringClass().getInterfaces();
>>>                       final Collection<Method> itfWithThisMethod = new
>>> ArrayList<Method>();
>>>                       for (final Class<?> i : interfaces) {
>>> -                        final Method m =
>>> Reflection.INSTANCE.getDeclaredMethod(i, method.getName(),
>>> method.getParameterTypes());
>>> +                        final Method m =
>>> Reflection.getDeclaredMethod(i, method.getName(),
>>> method.getParameterTypes());
>>>                           if (m != null) {
>>>                               itfWithThisMethod.add(m);
>>>                           }
>>> @@ -582,9 +586,9 @@ public class BeanDescriptorImpl extends
>>>                           returnValid++;
>>>                       }
>>>                       for (final Class<?> clazz : classHierarchy) {
>>> -                        final Method overriden =
>>> Reflection.INSTANCE.getDeclaredMethod(clazz, method.getName(),
>>> method.getParameterTypes());
>>> -                        if (overriden != null) {
>>> -                            if (overriden.getAnnotation(Valid.class) !=
>>> null) {
>>> +                        final Method overridden =
>>> Reflection.getDeclaredMethod(clazz, method.getName(),
>>> method.getParameterTypes());
>>> +                        if (overridden != null) {
>>> +                            if (overridden.getAnnotation(Valid.class)
>>> != null) {
>>>                                   returnValid++;
>>>                               }
>>>                           }
>>>
>>> Modified:
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/ClassValidator.java
>>> URL:
>>> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-
>>> jsr/src/main/java/org/apache/bval/jsr/ClassValidator.java?
>>> rev=1628598&r1=1628597&r2=1628598&view=diff
>>>
>>> ============================================================
>>> ==================
>>> ---
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/ClassValidator.java
>>> (original)
>>> +++
>>> bval/branches/bval-11/bval-jsr/src/main/java/org/apache/
>>> bval/jsr/ClassValidator.java
>>> Wed Oct  1 04:37:36 2014
>>> @@ -18,6 +18,33 @@
>>>    */
>>>   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;
>>> @@ -40,34 +67,7 @@ import org.apache.commons.lang3.ArrayUti
>>>   import org.apache.commons.lang3.ClassUtils;
>>>   import org.apache.commons.lang3.ObjectUtils;
>>>   import org.apache.commons.lang3.reflect.TypeUtils;
>>> -
>>> -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.BeanDe
>>
>> ...

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message