diff --git a/src/java/org/apache/commons/lang/builder/EqualsBuilder.java b/src/java/org/apache/commons/lang/builder/EqualsBuilder.java index 76be3656a..8899ca720 100644 --- a/src/java/org/apache/commons/lang/builder/EqualsBuilder.java +++ b/src/java/org/apache/commons/lang/builder/EqualsBuilder.java @@ -53,6 +53,7 @@ */ package org.apache.commons.lang.builder; +import java.lang.reflect.AccessibleObject; import java.lang.reflect.Field; import java.lang.reflect.Modifier; /** @@ -92,7 +93,7 @@ * *

Alternatively, there is a method that uses reflection to determine * the fields to test. Because these fields are usually private, the method, - * reflectionEquals, uses Field.setAccessible to + * reflectionEquals, uses AccessibleObject.setAccessible to * change the visibility of the fields. This will fail under a security * manager, unless the appropriate permissions are set up correctly. It is * also slower than testing explicitly.

@@ -108,7 +109,7 @@ * @author Stephen Colebourne * @author Gary Gregory * @since 1.0 - * @version $Id: EqualsBuilder.java,v 1.14 2003/07/14 22:25:03 bayard Exp $ + * @version $Id: EqualsBuilder.java,v 1.15 2003/07/20 01:11:05 ggregory Exp $ */ public class EqualsBuilder { /** @@ -133,7 +134,7 @@ public EqualsBuilder() { *

This method uses reflection to determine if the two Objects * are equal.

* - *

It uses Field.setAccessible to gain access to private + *

It uses AccessibleObject.setAccessible to gain access to private * fields. This means that it will throw a security exception if run under * a security manger, if the permissions are not set up correctly. It is also * not as efficient as testing explicitly.

@@ -155,7 +156,7 @@ public static boolean reflectionEquals(Object lhs, Object rhs) { *

This method uses reflection to determine if the two Objects * are equal.

* - *

It uses Field.setAccessible to gain access to private + *

It uses AccessibleObject.setAccessible to gain access to private * fields. This means that it will throw a security exception if run under * a security manger, if the permissions are not set up correctly. It is also * not as efficient as testing explicitly.

@@ -179,7 +180,7 @@ public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTrans *

This method uses reflection to determine if the two Objects * are equal.

* - *

It uses Field.setAccessible to gain access to private + *

It uses AccessibleObject.setAccessible to gain access to private * fields. This means that it will throw a security exception if run under * a security manger, if the permissions are not set up correctly. It is also * not as efficient as testing explicitly.

@@ -264,7 +265,7 @@ private static void reflectionAppend( EqualsBuilder builder, boolean useTransients) { Field[] fields = clazz.getDeclaredFields(); - Field.setAccessible(fields, true); + AccessibleObject.setAccessible(fields, true); for (int i = 0; i < fields.length && builder.isEquals; i++) { Field f = fields[i]; if ((f.getName().indexOf('$') == -1)