Severity Description Resource In Folder Location Creation Time
The static method setAccessible(AccessibleObject[], boolean) from the type AccessibleObject should be accessed directly EqualsBuilder.java Apache Jakarta Commons/lang/src/java/org/apache/commons/lang/builder line 268 July 19, 2003 6:10:35 PM git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137465 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
243fb789c6
commit
d27569f61a
|
@ -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 @@
|
|||
*
|
||||
* <p> Alternatively, there is a method that uses reflection to determine
|
||||
* the fields to test. Because these fields are usually private, the method,
|
||||
* <code>reflectionEquals</code>, uses <code>Field.setAccessible</code> to
|
||||
* <code>reflectionEquals</code>, uses <code>AccessibleObject.setAccessible</code> 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.</p>
|
||||
|
@ -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() {
|
|||
* <p>This method uses reflection to determine if the two <code>Object</code>s
|
||||
* are equal.</p>
|
||||
*
|
||||
* <p>It uses <code>Field.setAccessible</code> to gain access to private
|
||||
* <p>It uses <code>AccessibleObject.setAccessible</code> 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.</p>
|
||||
|
@ -155,7 +156,7 @@ public static boolean reflectionEquals(Object lhs, Object rhs) {
|
|||
* <p>This method uses reflection to determine if the two <code>Object</code>s
|
||||
* are equal.</p>
|
||||
*
|
||||
* <p>It uses <code>Field.setAccessible</code> to gain access to private
|
||||
* <p>It uses <code>AccessibleObject.setAccessible</code> 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.</p>
|
||||
|
@ -179,7 +180,7 @@ public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTrans
|
|||
* <p>This method uses reflection to determine if the two <code>Object</code>s
|
||||
* are equal.</p>
|
||||
*
|
||||
* <p>It uses <code>Field.setAccessible</code> to gain access to private
|
||||
* <p>It uses <code>AccessibleObject.setAccessible</code> 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.</p>
|
||||
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue