Top Description Fields Constructors Methods
org.assertj.core.util.introspection

pack-priv abstract Class MemberUtils

extends Object
Class Inheritance
Imports
java.lang.reflect.AccessibleObject, .Member, .Modifier

Shameless copy from Apache commons lang and then modified to keep only the interesting stuff for AssertJ. Contains common code for working with Methods/Constructors, extracted and refactored from MethodUtils when it was imported from Commons BeanUtils.

Field Summary

Modifier and TypeField and Description
private static final int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static boolean

Returns:

true unless package/protected/private modifier detected
isPackageAccess
(int
to test
modifiers
)

Returns whether a given set of modifiers implies package access.

pack-priv static void
setAccessibleWorkaround(AccessibleObject
the AccessibleObject to set as accessible
o
)

XXX Default access superclass workaround When a public class has a default access superclass with public members, these members are accessible.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ACCESS_TESTback to summary
private static final int ACCESS_TEST

Constructor Detail

MemberUtilsback to summary
pack-priv MemberUtils()

Method Detail

isPackageAccessback to summary
pack-priv static boolean isPackageAccess(int modifiers)

Returns whether a given set of modifiers implies package access.

Parameters
modifiers:int

to test

Returns:boolean

true unless package/protected/private modifier detected

setAccessibleWorkaroundback to summary
pack-priv static void setAccessibleWorkaround(AccessibleObject o)

XXX Default access superclass workaround When a public class has a default access superclass with public members, these members are accessible. Calling them from compiled code works fine. Unfortunately, on some JVMs, using reflection to invoke these members seems to (wrongly) prevent access even when the modifier is public. Calling setAccessible(true) solves the problem but will only work from sufficiently privileged code. Better workarounds would be gratefully accepted.

Parameters
o:AccessibleObject

the AccessibleObject to set as accessible