Author: epbernard
Date: 2009-08-11 14:00:25 -0400 (Tue, 11 Aug 2009)
New Revision: 17263
Added:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ContainsField.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ContainsMethod.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetAnnotationParameter.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetConstructor.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetDeclaredField.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetDeclaredFields.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetDeclaredMethods.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetMethod.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetMethodFromPropertyName.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetMethods.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/NewInstance.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/SetAccessibility.java
Removed:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/ContainsMethod.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetAnnotationParameter.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetConstructor.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethod.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethodFromPropertyName.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethods.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/NewInstance.java
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintValidatorFactoryImpl.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/resolver/DefaultTraversableResolver.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanMetaDataImpl.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintDescriptorImpl.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintHelper.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ReflectionHelper.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/annotationfactory/AnnotationFactory.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/annotationfactory/AnnotationProxy.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/xml/ValidationXmlParser.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/xml/XmlMappingParser.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/metadata/ConstraintHelperTest.java
Log:
HV-171 continuing implementation adding due doPriviledge when needed
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintValidatorFactoryImpl.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintValidatorFactoryImpl.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintValidatorFactoryImpl.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -20,9 +20,8 @@
import java.security.AccessController;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorFactory;
-import javax.validation.ValidationException;
-import org.hibernate.validation.util.priviledgedactions.NewInstance;
+import org.hibernate.validation.util.NewInstance;
/**
* Default <code>ConstraintValidatorFactory</code> using a no-arg
constructor.
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/resolver/DefaultTraversableResolver.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/resolver/DefaultTraversableResolver.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/resolver/DefaultTraversableResolver.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -10,7 +10,7 @@
import org.hibernate.validation.util.LoggerFactory;
import org.hibernate.validation.util.ReflectionHelper;
-import org.hibernate.validation.util.priviledgedactions.NewInstance;
+import org.hibernate.validation.util.NewInstance;
/**
* A JPA 2 aware <code>TraversableResolver</code>.
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanMetaDataImpl.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanMetaDataImpl.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanMetaDataImpl.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -31,7 +31,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
+import java.security.AccessController;
import javax.validation.GroupDefinitionException;
import javax.validation.GroupSequence;
import javax.validation.Valid;
@@ -44,6 +44,9 @@
import org.hibernate.validation.util.LoggerFactory;
import org.hibernate.validation.util.ReflectionHelper;
+import org.hibernate.validation.util.GetDeclaredFields;
+import org.hibernate.validation.util.GetDeclaredMethods;
+import org.hibernate.validation.util.SetAccessibility;
/**
@@ -258,7 +261,15 @@
}
private void initFieldConstraints(Class<?> clazz, AnnotationIgnores
annotationIgnores) {
- for ( Field field : clazz.getDeclaredFields() ) {
+ GetDeclaredFields action = GetDeclaredFields.action( clazz );
+ final Field[] fields;
+ if ( System.getSecurityManager() != null ) {
+ fields = AccessController.doPrivileged( action );
+ }
+ else {
+ fields = action.run();
+ }
+ for ( Field field : fields ) {
// HV-172
if ( Modifier.isStatic( field.getModifiers() ) ) {
continue;
@@ -272,20 +283,39 @@
if ( annotationIgnores.isIgnoreAnnotations( field ) ) {
break;
}
- ReflectionHelper.setAccessibility( field );
+ setAccessibility( field );
MetaConstraint<T, ?> metaConstraint = createMetaConstraint( field,
constraintDescription );
addMetaConstraint( clazz, metaConstraint );
}
if ( field.isAnnotationPresent( Valid.class ) ) {
- ReflectionHelper.setAccessibility( field );
+ setAccessibility( field );
cascadedMembers.add( field );
addPropertyDescriptorForMember( field );
}
}
}
+ private void setAccessibility(Member member) {
+ SetAccessibility action = SetAccessibility.action( member );
+ if (System.getSecurityManager() != null) {
+ AccessController.doPrivileged( action );
+ }
+ else {
+ action.run();
+ }
+ }
+
private void initMethodConstraints(Class<?> clazz, AnnotationIgnores
annotationIgnores) {
- for ( Method method : clazz.getDeclaredMethods() ) {
+ GetDeclaredMethods action = GetDeclaredMethods.action( clazz );
+ final Method[] declaredMethods;
+ if ( System.getSecurityManager() != null ) {
+ declaredMethods = AccessController.doPrivileged( action );
+ }
+ else {
+ declaredMethods = action.run();
+ }
+
+ for ( Method method : declaredMethods ) {
// HV-172
if ( Modifier.isStatic( method.getModifiers() ) ) {
continue;
@@ -300,12 +330,12 @@
if ( annotationIgnores.isIgnoreAnnotations( method ) ) {
break;
}
- ReflectionHelper.setAccessibility( method );
+ setAccessibility( method );
MetaConstraint<T, ?> metaConstraint = createMetaConstraint( method,
constraintDescription );
addMetaConstraint( clazz, metaConstraint );
}
if ( method.isAnnotationPresent( Valid.class ) ) {
- ReflectionHelper.setAccessibility( method );
+ setAccessibility( method );
cascadedMembers.add( method );
addPropertyDescriptorForMember( method );
}
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintDescriptorImpl.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintDescriptorImpl.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintDescriptorImpl.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -29,7 +29,6 @@
import java.util.Map;
import java.util.Set;
import java.security.AccessController;
-import java.security.PrivilegedAction;
import javax.validation.Constraint;
import javax.validation.ConstraintDefinitionException;
import javax.validation.ConstraintPayload;
@@ -43,10 +42,10 @@
import org.slf4j.Logger;
import org.hibernate.validation.util.LoggerFactory;
-import org.hibernate.validation.util.ReflectionHelper;
-import org.hibernate.validation.util.priviledgedactions.GetMethods;
-import org.hibernate.validation.util.priviledgedactions.GetMethod;
-import org.hibernate.validation.util.priviledgedactions.GetAnnotationParameter;
+import org.hibernate.validation.util.GetAnnotationParameter;
+import org.hibernate.validation.util.GetMethods;
+import org.hibernate.validation.util.GetMethod;
+import org.hibernate.validation.util.GetDeclaredMethods;
import org.hibernate.validation.util.annotationfactory.AnnotationDescriptor;
import org.hibernate.validation.util.annotationfactory.AnnotationFactory;
@@ -248,7 +247,14 @@
}
private Map<String, Object> buildAnnotationParameterMap(Annotation annotation) {
- Method[] declaredMethods = annotation.annotationType().getDeclaredMethods();
+ GetDeclaredMethods action = GetDeclaredMethods.action( annotation.annotationType() );
+ final Method[] declaredMethods;
+ if ( System.getSecurityManager() != null ) {
+ declaredMethods = AccessController.doPrivileged( action );
+ }
+ else {
+ declaredMethods = action.run();
+ }
Map<String, Object> parameters = new HashMap<String, Object>(
declaredMethods.length );
for ( Method m : declaredMethods ) {
try {
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintHelper.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintHelper.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintHelper.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -72,10 +72,9 @@
import org.hibernate.validation.constraints.impl.SizeValidatorForCollection;
import org.hibernate.validation.constraints.impl.SizeValidatorForMap;
import org.hibernate.validation.constraints.impl.SizeValidatorForString;
-import org.hibernate.validation.util.ReflectionHelper;
-import org.hibernate.validation.util.priviledgedactions.GetMethods;
-import org.hibernate.validation.util.priviledgedactions.GetMethod;
-import org.hibernate.validation.util.priviledgedactions.GetAnnotationParameter;
+import org.hibernate.validation.util.GetMethods;
+import org.hibernate.validation.util.GetMethod;
+import org.hibernate.validation.util.GetAnnotationParameter;
/**
* Keeps track of builtin constraints and their validator implementations, as well as
already resolved validator definitions.
Copied:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ContainsField.java
(from rev 17261,
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/ContainsMethod.java)
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ContainsField.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ContainsField.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -0,0 +1,30 @@
+package org.hibernate.validation.util;
+
+import java.security.PrivilegedAction;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class ContainsField implements PrivilegedAction<Boolean> {
+ private final Class<?> clazz;
+ private final String property;
+
+ public static ContainsField action(Class<?> clazz, String property) {
+ return new ContainsField( clazz, property );
+ }
+
+ private ContainsField(Class<?> clazz, String property) {
+ this.clazz = clazz;
+ this.property = property;
+ }
+
+ public Boolean run() {
+ try {
+ clazz.getDeclaredField( property );
+ return true;
+ }
+ catch ( NoSuchFieldException e ) {
+ return false;
+ }
+ }
+}
\ No newline at end of file
Copied:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ContainsMethod.java
(from rev 17261,
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/ContainsMethod.java)
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ContainsMethod.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ContainsMethod.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -0,0 +1,26 @@
+package org.hibernate.validation.util;
+
+import java.security.PrivilegedAction;
+
+import org.hibernate.validation.util.ReflectionHelper;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class ContainsMethod implements PrivilegedAction<Boolean> {
+ private final Class<?> clazz;
+ private final String property;
+
+ public static ContainsMethod action(Class<?> clazz, String property) {
+ return new ContainsMethod( clazz, property );
+ }
+
+ private ContainsMethod(Class<?> clazz, String property) {
+ this.clazz = clazz;
+ this.property = property;
+ }
+
+ public Boolean run() {
+ return ReflectionHelper.getMethod( clazz, property ) != null;
+ }
+}
\ No newline at end of file
Copied:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetAnnotationParameter.java
(from rev 17261,
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetAnnotationParameter.java)
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetAnnotationParameter.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetAnnotationParameter.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -0,0 +1,30 @@
+package org.hibernate.validation.util;
+
+import java.lang.annotation.Annotation;
+import java.security.PrivilegedAction;
+
+import org.hibernate.validation.util.ReflectionHelper;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class GetAnnotationParameter<T> implements PrivilegedAction<T> {
+ private final Annotation annotation;
+ private final String parameterName;
+ private final Class<T> type;
+
+
+ public static <T> GetAnnotationParameter<T> action(Annotation annotation,
String parameterName, Class<T> type) {
+ return new GetAnnotationParameter<T>( annotation, parameterName, type );
+ }
+
+ private GetAnnotationParameter(Annotation annotation, String parameterName,
Class<T> type) {
+ this.annotation = annotation;
+ this.parameterName = parameterName;
+ this.type = type;
+ }
+
+ public T run() {
+ return ReflectionHelper.getAnnotationParameter( annotation, parameterName, type );
+ }
+}
Copied:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetConstructor.java
(from rev 17261,
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetConstructor.java)
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetConstructor.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetConstructor.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -0,0 +1,30 @@
+package org.hibernate.validation.util;
+
+import java.lang.reflect.Constructor;
+import java.security.PrivilegedAction;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class GetConstructor<T> implements
PrivilegedAction<Constructor<T>> {
+ private final Class<T> clazz;
+ private final Class<?>[] params;
+
+ public static <T> GetConstructor<T> action(Class<T> clazz,
Class<?>... params) {
+ return new GetConstructor<T>( clazz, params );
+ }
+
+ private GetConstructor(Class<T> clazz, Class<?>... params) {
+ this.clazz = clazz;
+ this.params = params;
+ }
+
+ public Constructor<T> run() {
+ try {
+ return clazz.getConstructor(params);
+ }
+ catch ( NoSuchMethodException e ) {
+ return null;
+ }
+ }
+}
\ No newline at end of file
Added:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetDeclaredField.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetDeclaredField.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetDeclaredField.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -0,0 +1,34 @@
+package org.hibernate.validation.util;
+
+import java.security.PrivilegedAction;
+import java.lang.reflect.Field;
+
+import org.hibernate.validation.util.ReflectionHelper;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class GetDeclaredField implements PrivilegedAction<Field> {
+ private final Class<?> clazz;
+ private final String fieldName;
+
+ public static GetDeclaredField action(Class<?> clazz, String fieldName) {
+ return new GetDeclaredField( clazz, fieldName );
+ }
+
+ private GetDeclaredField(Class<?> clazz, String fieldName) {
+ this.clazz = clazz;
+ this.fieldName = fieldName;
+ }
+
+ public Field run() {
+ try {
+ final Field field = clazz.getDeclaredField( fieldName );
+ ReflectionHelper.setAccessibility( field );
+ return field;
+ }
+ catch ( NoSuchFieldException e ) {
+ return null;
+ }
+ }
+}
\ No newline at end of file
Copied:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetDeclaredFields.java
(from rev 17261,
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethods.java)
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetDeclaredFields.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetDeclaredFields.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -0,0 +1,23 @@
+package org.hibernate.validation.util;
+
+import java.security.PrivilegedAction;
+import java.lang.reflect.Field;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class GetDeclaredFields implements PrivilegedAction<Field[]> {
+ private final Class<?> clazz;
+
+ public static GetDeclaredFields action(Class<?> clazz) {
+ return new GetDeclaredFields( clazz );
+ }
+
+ private GetDeclaredFields(Class<?> clazz) {
+ this.clazz = clazz;
+ }
+
+ public Field[] run() {
+ return clazz.getDeclaredFields();
+ }
+}
\ No newline at end of file
Copied:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetDeclaredMethods.java
(from rev 17261,
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethods.java)
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetDeclaredMethods.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetDeclaredMethods.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -0,0 +1,23 @@
+package org.hibernate.validation.util;
+
+import java.security.PrivilegedAction;
+import java.lang.reflect.Method;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class GetDeclaredMethods implements PrivilegedAction<Method[]> {
+ private final Class<?> clazz;
+
+ public static GetDeclaredMethods action(Class<?> clazz) {
+ return new GetDeclaredMethods( clazz );
+ }
+
+ private GetDeclaredMethods(Class<?> clazz) {
+ this.clazz = clazz;
+ }
+
+ public Method[] run() {
+ return clazz.getDeclaredMethods();
+ }
+}
\ No newline at end of file
Copied:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetMethod.java
(from rev 17261,
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethod.java)
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetMethod.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetMethod.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -0,0 +1,30 @@
+package org.hibernate.validation.util;
+
+import java.lang.reflect.Method;
+import java.security.PrivilegedAction;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class GetMethod implements PrivilegedAction<Method> {
+ private final Class<?> clazz;
+ private final String methodName;
+
+ public static GetMethod action(Class<?> clazz, String methodName) {
+ return new GetMethod( clazz, methodName );
+ }
+
+ private GetMethod(Class<?> clazz, String methodName) {
+ this.clazz = clazz;
+ this.methodName = methodName;
+ }
+
+ public Method run() {
+ try {
+ return clazz.getMethod(methodName);
+ }
+ catch ( NoSuchMethodException e ) {
+ return null;
+ }
+ }
+}
Copied:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetMethodFromPropertyName.java
(from rev 17261,
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethodFromPropertyName.java)
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetMethodFromPropertyName.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetMethodFromPropertyName.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -0,0 +1,27 @@
+package org.hibernate.validation.util;
+
+import java.lang.reflect.Method;
+import java.security.PrivilegedAction;
+
+import org.hibernate.validation.util.ReflectionHelper;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class GetMethodFromPropertyName implements PrivilegedAction<Method> {
+ private final Class<?> clazz;
+ private final String property;
+
+ public static GetMethodFromPropertyName action(Class<?> clazz, String property) {
+ return new GetMethodFromPropertyName( clazz, property );
+ }
+
+ private GetMethodFromPropertyName(Class<?> clazz, String property) {
+ this.clazz = clazz;
+ this.property = property;
+ }
+
+ public Method run() {
+ return ReflectionHelper.getMethod( clazz, property );
+ }
+}
\ No newline at end of file
Copied:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetMethods.java
(from rev 17261,
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethods.java)
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetMethods.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/GetMethods.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -0,0 +1,23 @@
+package org.hibernate.validation.util;
+
+import java.security.PrivilegedAction;
+import java.lang.reflect.Method;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class GetMethods implements PrivilegedAction<Method[]> {
+ private final Class<?> clazz;
+
+ public static GetMethods action(Class<?> clazz) {
+ return new GetMethods( clazz );
+ }
+
+ private GetMethods(Class<?> clazz) {
+ this.clazz = clazz;
+ }
+
+ public Method[] run() {
+ return clazz.getMethods();
+ }
+}
Copied:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/NewInstance.java
(from rev 17261,
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/NewInstance.java)
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/NewInstance.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/NewInstance.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -0,0 +1,36 @@
+package org.hibernate.validation.util;
+
+import java.security.PrivilegedAction;
+import javax.validation.ValidationException;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class NewInstance<T> implements PrivilegedAction<T> {
+ private final Class<T> clazz;
+ private final String message;
+
+ public static <T> NewInstance<T> action(Class<T> clazz, String
message) {
+ return new NewInstance<T>( clazz, message );
+ }
+
+ private NewInstance(Class<T> clazz, String message) {
+ this.clazz = clazz;
+ this.message = message;
+ }
+
+ public T run() {
+ try {
+ return clazz.newInstance();
+ }
+ catch ( InstantiationException e ) {
+ throw new ValidationException( "Unable to instanciate " + message + ":
" + clazz, e );
+ }
+ catch ( IllegalAccessException e ) {
+ throw new ValidationException( "Unable to instanciate " + clazz, e );
+ }
+ catch ( RuntimeException e ) {
+ throw new ValidationException( "Unable to instanciate " + clazz, e );
+ }
+ }
+}
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ReflectionHelper.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ReflectionHelper.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ReflectionHelper.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -52,7 +52,7 @@
//run client in priviledge block
@SuppressWarnings("unchecked")
- public static <T> T getAnnotationParameter(Annotation annotation, String
parameterName, Class<T> type) {
+ static <T> T getAnnotationParameter(Annotation annotation, String parameterName,
Class<T> type) {
try {
Method m = annotation.getClass().getMethod( parameterName );
Object o = m.invoke( annotation );
@@ -190,7 +190,8 @@
return value;
}
- public static void setAccessibility(Member member) {
+ //run client in priviledge block
+ static void setAccessibility(Member member) {
if ( !Modifier.isPublic( member.getModifiers() ) ) {
//Sun's ease of use, sigh...
( ( AccessibleObject ) member ).setAccessible( true );
@@ -356,57 +357,6 @@
}
/**
- * Checks whether the specified class contains a field matching the specified name.
- *
- * @param clazz The class to check.
- * @param fieldName The field name.
- *
- * @return Returns <code>true</code> if the cass contains a field for the
specified name, <code>
- * false</code> otherwise.
- */
- public static boolean containsField(Class<?> clazz, String fieldName) {
- try {
- clazz.getDeclaredField( fieldName );
- return true;
- }
- catch ( NoSuchFieldException e ) {
- return false;
- }
- }
-
- /**
- * Returns the field with the specified name or <code>null</code> if it does
not exist.
- *
- * @param clazz The class to check.
- * @param fieldName The field name.
- *
- * @return Returns the field with the specified name or <code>null</code> if
it does not exist.
- */
- public static Field getField(Class<?> clazz, String fieldName) {
- try {
- Field field = clazz.getDeclaredField( fieldName );
- setAccessibility( field );
- return field;
- }
- catch ( NoSuchFieldException e ) {
- return null;
- }
- }
-
- /**
- * Checks whether the specified class contains a method matching the specified name.
- *
- * @param clazz The class to check.
- * @param methodName The method name.
- *
- * @return Returns <code>true</code> if the cass contains a property for the
specified name, <code>
- * false</code> otherwise.
- */
- public static boolean containsMethod(Class<?> clazz, String methodName) {
- return getMethod( clazz, methodName ) != null;
- }
-
- /**
* Returns the method with the specified name or <code>null</code> if it
does not exist.
*
* @param clazz The class to check.
@@ -414,7 +364,8 @@
*
* @return Returns the method with the specified name or <code>null</code>
if it does not exist.
*/
- public static Method getMethod(Class<?> clazz, String methodName) {
+ //run client in priviledge block
+ static Method getMethod(Class<?> clazz, String methodName) {
try {
char string[] = methodName.toCharArray();
string[0] = Character.toUpperCase( string[0] );
Copied:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/SetAccessibility.java
(from rev 17261,
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethod.java)
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/SetAccessibility.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/SetAccessibility.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -0,0 +1,26 @@
+package org.hibernate.validation.util;
+
+import java.lang.reflect.Member;
+import java.security.PrivilegedAction;
+
+import org.hibernate.validation.util.ReflectionHelper;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class SetAccessibility implements PrivilegedAction<Object> {
+ private final Member member;
+
+ public static SetAccessibility action(Member member) {
+ return new SetAccessibility( member );
+ }
+
+ private SetAccessibility(Member member) {
+ this.member = member;
+ }
+
+ public Object run() {
+ ReflectionHelper.setAccessibility( member );
+ return member;
+ }
+}
\ No newline at end of file
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/annotationfactory/AnnotationFactory.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/annotationfactory/AnnotationFactory.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/annotationfactory/AnnotationFactory.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -24,7 +24,7 @@
import java.lang.reflect.Proxy;
import java.security.AccessController;
-import org.hibernate.validation.util.priviledgedactions.GetConstructor;
+import org.hibernate.validation.util.GetConstructor;
/**
@@ -64,6 +64,6 @@
else {
constructor = action.run();
}
- return constructor.newInstance( new Object[]{handler} );
+ return constructor.newInstance( handler );
}
}
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/annotationfactory/AnnotationProxy.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/annotationfactory/AnnotationProxy.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/annotationfactory/AnnotationProxy.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -25,7 +25,10 @@
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
+import java.security.AccessController;
+import org.hibernate.validation.util.GetDeclaredMethods;
+
/**
* A concrete implementation of <code>Annotation</code> that pretends it is
a
* "real" source code annotation. It's also an
<code>InvocationHandler</code>.
@@ -66,7 +69,15 @@
private Map<Method, Object> getAnnotationValues(AnnotationDescriptor descriptor)
{
Map<Method, Object> result = new HashMap<Method, Object>();
int processedValuesFromDescriptor = 0;
- for ( Method m : annotationType.getDeclaredMethods() ) {
+ GetDeclaredMethods action = GetDeclaredMethods.action( annotationType );
+ final Method[] declaredMethods;
+ if ( System.getSecurityManager() != null ) {
+ declaredMethods = AccessController.doPrivileged( action );
+ }
+ else {
+ declaredMethods = action.run();
+ }
+ for ( Method m : declaredMethods ) {
if ( descriptor.containsElement( m.getName() ) ) {
result.put( m, descriptor.valueOf( m.getName() ) );
processedValuesFromDescriptor++;
Deleted:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/ContainsMethod.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/ContainsMethod.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/ContainsMethod.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -1,27 +0,0 @@
-package org.hibernate.validation.util.priviledgedactions;
-
-import java.lang.reflect.Method;
-import java.security.PrivilegedAction;
-
-import org.hibernate.validation.util.ReflectionHelper;
-
-/**
- * @author Emmanuel Bernard
- */
-public class ContainsMethod implements PrivilegedAction<Boolean> {
- private final Class<?> clazz;
- private final String property;
-
- public static ContainsMethod action(Class<?> clazz, String property) {
- return new ContainsMethod( clazz, property );
- }
-
- private ContainsMethod(Class<?> clazz, String property) {
- this.clazz = clazz;
- this.property = property;
- }
-
- public Boolean run() {
- return ReflectionHelper.containsMethod( clazz, property );
- }
-}
\ No newline at end of file
Deleted:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetAnnotationParameter.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetAnnotationParameter.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetAnnotationParameter.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -1,31 +0,0 @@
-package org.hibernate.validation.util.priviledgedactions;
-
-import java.lang.reflect.Method;
-import java.lang.annotation.Annotation;
-import java.security.PrivilegedAction;
-
-import org.hibernate.validation.util.ReflectionHelper;
-
-/**
- * @author Emmanuel Bernard
- */
-public class GetAnnotationParameter<T> implements PrivilegedAction<T> {
- private final Annotation annotation;
- private final String parameterName;
- private final Class<T> type;
-
-
- public static <T> GetAnnotationParameter<T> action(Annotation annotation,
String parameterName, Class<T> type) {
- return new GetAnnotationParameter<T>( annotation, parameterName, type );
- }
-
- private GetAnnotationParameter(Annotation annotation, String parameterName,
Class<T> type) {
- this.annotation = annotation;
- this.parameterName = parameterName;
- this.type = type;
- }
-
- public T run() {
- return ReflectionHelper.getAnnotationParameter( annotation, parameterName, type );
- }
-}
Deleted:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetConstructor.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetConstructor.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetConstructor.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -1,31 +0,0 @@
-package org.hibernate.validation.util.priviledgedactions;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Constructor;
-import java.security.PrivilegedAction;
-
-/**
- * @author Emmanuel Bernard
- */
-public class GetConstructor<T> implements
PrivilegedAction<Constructor<T>> {
- private final Class<T> clazz;
- private final Class<?>[] params;
-
- public static <T> GetConstructor<T> action(Class<T> clazz,
Class<?>... params) {
- return new GetConstructor<T>( clazz, params );
- }
-
- private GetConstructor(Class<T> clazz, Class<?>... params) {
- this.clazz = clazz;
- this.params = params;
- }
-
- public Constructor<T> run() {
- try {
- return clazz.getConstructor(params);
- }
- catch ( NoSuchMethodException e ) {
- return null;
- }
- }
-}
\ No newline at end of file
Deleted:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethod.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethod.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethod.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -1,30 +0,0 @@
-package org.hibernate.validation.util.priviledgedactions;
-
-import java.lang.reflect.Method;
-import java.security.PrivilegedAction;
-
-/**
- * @author Emmanuel Bernard
- */
-public class GetMethod implements PrivilegedAction<Method> {
- private final Class<?> clazz;
- private final String methodName;
-
- public static GetMethod action(Class<?> clazz, String methodName) {
- return new GetMethod( clazz, methodName );
- }
-
- private GetMethod(Class<?> clazz, String methodName) {
- this.clazz = clazz;
- this.methodName = methodName;
- }
-
- public Method run() {
- try {
- return clazz.getMethod(methodName);
- }
- catch ( NoSuchMethodException e ) {
- return null;
- }
- }
-}
Deleted:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethodFromPropertyName.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethodFromPropertyName.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethodFromPropertyName.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -1,27 +0,0 @@
-package org.hibernate.validation.util.priviledgedactions;
-
-import java.lang.reflect.Method;
-import java.security.PrivilegedAction;
-
-import org.hibernate.validation.util.ReflectionHelper;
-
-/**
- * @author Emmanuel Bernard
- */
-public class GetMethodFromPropertyName implements PrivilegedAction<Method> {
- private final Class<?> clazz;
- private final String property;
-
- public static GetMethodFromPropertyName action(Class<?> clazz, String property) {
- return new GetMethodFromPropertyName( clazz, property );
- }
-
- private GetMethodFromPropertyName(Class<?> clazz, String property) {
- this.clazz = clazz;
- this.property = property;
- }
-
- public Method run() {
- return ReflectionHelper.getMethod( clazz, property );
- }
-}
\ No newline at end of file
Deleted:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethods.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethods.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/GetMethods.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -1,23 +0,0 @@
-package org.hibernate.validation.util.priviledgedactions;
-
-import java.security.PrivilegedAction;
-import java.lang.reflect.Method;
-
-/**
- * @author Emmanuel Bernard
- */
-public class GetMethods implements PrivilegedAction<Method[]> {
- private final Class<?> clazz;
-
- public static GetMethods action(Class<?> clazz) {
- return new GetMethods( clazz );
- }
-
- private GetMethods(Class<?> clazz) {
- this.clazz = clazz;
- }
-
- public Method[] run() {
- return clazz.getMethods();
- }
-}
Deleted:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/NewInstance.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/NewInstance.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/priviledgedactions/NewInstance.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -1,37 +0,0 @@
-package org.hibernate.validation.util.priviledgedactions;
-
-import java.lang.reflect.Method;
-import java.security.PrivilegedAction;
-import javax.validation.ValidationException;
-
-/**
- * @author Emmanuel Bernard
- */
-public class NewInstance<T> implements PrivilegedAction<T> {
- private final Class<T> clazz;
- private final String message;
-
- public static <T> NewInstance<T> action(Class<T> clazz, String
message) {
- return new NewInstance<T>( clazz, message );
- }
-
- private NewInstance(Class<T> clazz, String message) {
- this.clazz = clazz;
- this.message = message;
- }
-
- public T run() {
- try {
- return clazz.newInstance();
- }
- catch ( InstantiationException e ) {
- throw new ValidationException( "Unable to instanciate " + message + ":
" + clazz, e );
- }
- catch ( IllegalAccessException e ) {
- throw new ValidationException( "Unable to instanciate " + clazz, e );
- }
- catch ( RuntimeException e ) {
- throw new ValidationException( "Unable to instanciate " + clazz, e );
- }
- }
-}
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/xml/ValidationXmlParser.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/xml/ValidationXmlParser.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/xml/ValidationXmlParser.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -38,7 +38,7 @@
import org.hibernate.validation.util.LoggerFactory;
import org.hibernate.validation.util.ReflectionHelper;
-import org.hibernate.validation.util.priviledgedactions.NewInstance;
+import org.hibernate.validation.util.NewInstance;
import org.hibernate.validation.xml.PropertyType;
import org.hibernate.validation.xml.ValidationConfigType;
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/xml/XmlMappingParser.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/xml/XmlMappingParser.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/xml/XmlMappingParser.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -54,9 +54,11 @@
import org.hibernate.validation.metadata.AnnotationIgnores;
import org.hibernate.validation.util.LoggerFactory;
import org.hibernate.validation.util.ReflectionHelper;
-import org.hibernate.validation.util.priviledgedactions.GetMethodFromPropertyName;
-import org.hibernate.validation.util.priviledgedactions.ContainsMethod;
-import org.hibernate.validation.util.priviledgedactions.GetMethod;
+import org.hibernate.validation.util.ContainsField;
+import org.hibernate.validation.util.GetMethodFromPropertyName;
+import org.hibernate.validation.util.ContainsMethod;
+import org.hibernate.validation.util.GetMethod;
+import org.hibernate.validation.util.GetDeclaredField;
import org.hibernate.validation.util.annotationfactory.AnnotationDescriptor;
import org.hibernate.validation.util.annotationfactory.AnnotationFactory;
import org.hibernate.validation.xml.AnnotationType;
@@ -242,10 +244,25 @@
private void parseFieldLevelOverrides(List<FieldType> fields, Class<?>
beanClass, String defaultPackage) {
for ( FieldType fieldType : fields ) {
String fieldName = fieldType.getName();
- if ( !ReflectionHelper.containsField( beanClass, fieldName ) ) {
+ final boolean containsField;
+ ContainsField containsAction = ContainsField.action( beanClass, fieldName );
+ if ( System.getSecurityManager() != null ) {
+ containsField = AccessController.doPrivileged( containsAction );
+ }
+ else {
+ containsField = containsAction.run();
+ }
+ if ( !containsField ) {
throw new ValidationException( beanClass.getName() + " does not contain the
fieldType " + fieldName );
}
- Field field = ReflectionHelper.getField( beanClass, fieldName );
+ GetDeclaredField action = GetDeclaredField.action( beanClass, fieldName );
+ final Field field;
+ if ( System.getSecurityManager() != null ) {
+ field = AccessController.doPrivileged( action );
+ }
+ else {
+ field = action.run();
+ }
// ignore annotations
boolean ignoreFieldAnnotation = fieldType.isIgnoreAnnotations() == null ? false :
fieldType.isIgnoreAnnotations();
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/metadata/ConstraintHelperTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/metadata/ConstraintHelperTest.java 2009-08-11
15:37:23 UTC (rev 17262)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/metadata/ConstraintHelperTest.java 2009-08-11
18:00:25 UTC (rev 17263)
@@ -19,6 +19,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
+import java.lang.reflect.Member;
import java.util.List;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
@@ -29,6 +30,7 @@
import org.testng.annotations.Test;
import org.hibernate.validation.util.ReflectionHelper;
+import org.hibernate.validation.util.SetAccessibility;
/**
* @author Hardy Ferentschik
@@ -48,7 +50,7 @@
Field[] fields = engine.getClass().getDeclaredFields();
assertNotNull( fields );
assertTrue( fields.length == 1 );
- ReflectionHelper.setAccessibility( fields[0] );
+ setAccessibility( fields[0] );
Annotation annotation = fields[0].getAnnotation( Pattern.List.class );
assertNotNull( annotation );
@@ -62,11 +64,15 @@
fields = order.getClass().getDeclaredFields();
assertNotNull( fields );
assertTrue( fields.length == 1 );
- ReflectionHelper.setAccessibility( fields[0] );
+ setAccessibility( fields[0] );
annotation = fields[0].getAnnotation( NotNull.class );
assertNotNull( annotation );
multiValueConstraintAnnotations = constraintHelper.getMultiValueConstraints( annotation
);
assertTrue( multiValueConstraintAnnotations.size() == 0, "There should be no
constraint annotations" );
}
+
+ void setAccessibility(Member member) {
+ SetAccessibility.action( member ).run();
+ }
}