I'm coding a superclass for my entity beans. Because I wish to implement
my own toString, equals and hashCode methods, I would like to access the
fields on the entity subclasses.
I see in the OpenJPA code that you're using setAccessible (e.g. see
below from org.apache.openjpa.enhance.Reflection) and I was wondering:
have you come across any situations where security is a problem? /I
gather that this will fail under a security manager// unless the
appropriate permissions are set up correctly. It is also// slower than
testing explicitly. Just wondering whether there was any further progress?
/ private static void makeAccessible(AccessibleObject ao, int mods) {
try {
if (!Modifier.isPublic(mods) && !ao.isAccessible())
AccessController.doPrivileged(J2DoPrivHelper
.setAccessibleAction(ao, true));
} catch (SecurityException se) {
throw new UserException(_loc.get("reflect-security", ao)).
setFatal(true);
}
}
regards
Adam