equal
deleted
inserted
replaced
79 // Cached field accessor created with override |
79 // Cached field accessor created with override |
80 private FieldAccessor overrideFieldAccessor; |
80 private FieldAccessor overrideFieldAccessor; |
81 // For sharing of FieldAccessors. This branching structure is |
81 // For sharing of FieldAccessors. This branching structure is |
82 // currently only two levels deep (i.e., one root Field and |
82 // currently only two levels deep (i.e., one root Field and |
83 // potentially many Field objects pointing to it.) |
83 // potentially many Field objects pointing to it.) |
|
84 // |
|
85 // If this branching structure would ever contain cycles, deadlocks can |
|
86 // occur in annotation code. |
84 private Field root; |
87 private Field root; |
85 |
88 |
86 // Generics infrastructure |
89 // Generics infrastructure |
87 |
90 |
88 private String getGenericSignature() {return signature;} |
91 private String getGenericSignature() {return signature;} |
139 // method in the VM. (All of this contortion is only necessary |
142 // method in the VM. (All of this contortion is only necessary |
140 // because of the "accessibility" bit in AccessibleObject, |
143 // because of the "accessibility" bit in AccessibleObject, |
141 // which implicitly requires that new java.lang.reflect |
144 // which implicitly requires that new java.lang.reflect |
142 // objects be fabricated for each reflective call on Class |
145 // objects be fabricated for each reflective call on Class |
143 // objects.) |
146 // objects.) |
|
147 if (this.root != null) |
|
148 throw new IllegalArgumentException("Can not copy a non-root Field"); |
|
149 |
144 Field res = new Field(clazz, name, type, modifiers, slot, signature, annotations); |
150 Field res = new Field(clazz, name, type, modifiers, slot, signature, annotations); |
145 res.root = this; |
151 res.root = this; |
146 // Might as well eagerly propagate this if already present |
152 // Might as well eagerly propagate this if already present |
147 res.fieldAccessor = fieldAccessor; |
153 res.fieldAccessor = fieldAccessor; |
148 res.overrideFieldAccessor = overrideFieldAccessor; |
154 res.overrideFieldAccessor = overrideFieldAccessor; |
1135 |
1141 |
1136 private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations; |
1142 private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations; |
1137 |
1143 |
1138 private synchronized Map<Class<? extends Annotation>, Annotation> declaredAnnotations() { |
1144 private synchronized Map<Class<? extends Annotation>, Annotation> declaredAnnotations() { |
1139 if (declaredAnnotations == null) { |
1145 if (declaredAnnotations == null) { |
1140 declaredAnnotations = AnnotationParser.parseAnnotations( |
1146 Field root = this.root; |
1141 annotations, sun.misc.SharedSecrets.getJavaLangAccess(). |
1147 if (root != null) { |
1142 getConstantPool(getDeclaringClass()), |
1148 declaredAnnotations = root.declaredAnnotations(); |
1143 getDeclaringClass()); |
1149 } else { |
|
1150 declaredAnnotations = AnnotationParser.parseAnnotations( |
|
1151 annotations, |
|
1152 sun.misc.SharedSecrets.getJavaLangAccess().getConstantPool(getDeclaringClass()), |
|
1153 getDeclaringClass()); |
|
1154 } |
1144 } |
1155 } |
1145 return declaredAnnotations; |
1156 return declaredAnnotations; |
1146 } |
1157 } |
1147 |
1158 |
1148 private native byte[] getTypeAnnotationBytes0(); |
1159 private native byte[] getTypeAnnotationBytes0(); |