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

Print this page

        

*** 56,71 **** * @author Nakul Saraiya */ public final class Field extends AccessibleObject implements Member { ! private Class clazz; private int slot; // This is guaranteed to be interned by the VM in the 1.4 // reflection implementation private String name; ! private Class type; private int modifiers; // Generics and annotations support private transient String signature; // generic info repository; lazily initialized private transient FieldRepository genericInfo; --- 56,71 ---- * @author Nakul Saraiya */ public final class Field extends AccessibleObject implements Member { ! private Class<?> clazz; private int slot; // This is guaranteed to be interned by the VM in the 1.4 // reflection implementation private String name; ! private Class<?> type; private int modifiers; // Generics and annotations support private transient String signature; // generic info repository; lazily initialized private transient FieldRepository genericInfo;
*** 79,90 **** // 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;} --- 79,90 ---- // 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;}
*** 110,122 **** /** * Package-private constructor used by ReflectAccess to enable * instantiation of these objects in Java code from the java.lang * package via sun.reflect.LangReflectAccess. */ ! Field(Class declaringClass, String name, ! Class type, int modifiers, int slot, String signature, byte[] annotations) { --- 110,122 ---- /** * Package-private constructor used by ReflectAccess to enable * instantiation of these objects in Java code from the java.lang * package via sun.reflect.LangReflectAccess. */ ! Field(Class<?> declaringClass, String name, ! Class<?> type, int modifiers, int slot, String signature, byte[] annotations) {
*** 962,973 **** // routine. The depth of the "getCallerClass" call is hardwired so // 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) --- 962,973 ---- // routine. The depth of the "getCallerClass" call is hardwired so // 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)
*** 985,998 **** } /* * Utility routine to paper over array type names */ ! static String getTypeName(Class type) { if (type.isArray()) { try { ! Class cl = type; int dimensions = 0; while (cl.isArray()) { dimensions++; cl = cl.getComponentType(); } --- 985,998 ---- } /* * Utility routine to paper over array type names */ ! static String getTypeName(Class<?> type) { if (type.isArray()) { try { ! Class<?> cl = type; int dimensions = 0; while (cl.isArray()) { dimensions++; cl = cl.getComponentType(); }
*** 1023,1035 **** */ public Annotation[] getDeclaredAnnotations() { return AnnotationParser.toArray(declaredAnnotations()); } ! private transient Map<Class, Annotation> declaredAnnotations; ! private synchronized Map<Class, Annotation> declaredAnnotations() { if (declaredAnnotations == null) { declaredAnnotations = AnnotationParser.parseAnnotations( annotations, sun.misc.SharedSecrets.getJavaLangAccess(). getConstantPool(getDeclaringClass()), getDeclaringClass()); --- 1023,1035 ---- */ public Annotation[] getDeclaredAnnotations() { return AnnotationParser.toArray(declaredAnnotations()); } ! private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations; ! private synchronized Map<Class<? extends Annotation>, Annotation> declaredAnnotations() { if (declaredAnnotations == null) { declaredAnnotations = AnnotationParser.parseAnnotations( annotations, sun.misc.SharedSecrets.getJavaLangAccess(). getConstantPool(getDeclaringClass()), getDeclaringClass());