src/share/classes/java/lang/reflect/Field.java

Print this page
rev 3746 : [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 ----
*** 934,943 **** --- 929,939 ---- } else { // Otherwise fabricate one and propagate it up to the root tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck); setFieldAccessor(tmp, overrideFinalCheck); } + return tmp; } // Returns FieldAccessor for this Field object, not looking up // the chain to the root
*** 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; ! } } } } /* --- 959,970 ---- // 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); } } } /*