src/share/classes/java/lang/reflect/Field.java
Print this page
rev 3731 : [mq]: cr6565585.ao
*** 77,91 ****
// For sharing of FieldAccessors. This branching structure is
// currently only two levels deep (i.e., one root Field and
// potentially many Field objects pointing to it.)
private Field root;
- // More complicated security check cache needed here than for
- // Class.newInstance() and Constructor.newInstance()
- private Class<?> securityCheckCache;
- private Class<?> securityCheckTargetClassCache;
-
// Generics infrastructure
private String getGenericSignature() {return signature;}
// Accessor for factory
--- 77,86 ----
*** 963,987 ****
// that the compiler can have an easier time if this gets inlined.
private void doSecurityCheck(Object obj) throws IllegalAccessException {
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
Class<?> caller = Reflection.getCallerClass(4);
! Class<?> targetClass = ((obj == null || !Modifier.isProtected(modifiers))
! ? clazz
! : obj.getClass());
!
! synchronized (this) {
! if ((securityCheckCache == caller)
! && (securityCheckTargetClassCache == targetClass)) {
! return;
! }
! }
! Reflection.ensureMemberAccess(caller, clazz, obj, modifiers);
! synchronized (this) {
! securityCheckCache = caller;
! securityCheckTargetClassCache = targetClass;
! }
}
}
}
/*
--- 958,969 ----
// that the compiler can have an easier time if this gets inlined.
private void doSecurityCheck(Object obj) throws IllegalAccessException {
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
Class<?> caller = Reflection.getCallerClass(4);
!
! checkAccess(caller, clazz, obj, modifiers);
}
}
}
/*