77 private byte[] annotationDefault; |
77 private byte[] annotationDefault; |
78 private volatile MethodAccessor methodAccessor; |
78 private volatile MethodAccessor methodAccessor; |
79 // For sharing of MethodAccessors. This branching structure is |
79 // For sharing of MethodAccessors. This branching structure is |
80 // currently only two levels deep (i.e., one root Method and |
80 // currently only two levels deep (i.e., one root Method and |
81 // potentially many Method objects pointing to it.) |
81 // potentially many Method objects pointing to it.) |
|
82 // |
|
83 // If this branching structure would ever contain cycles, deadlocks can |
|
84 // occur in annotation code. |
82 private Method root; |
85 private Method root; |
83 |
86 |
84 // Generics infrastructure |
87 // Generics infrastructure |
85 private String getGenericSignature() {return signature;} |
88 private String getGenericSignature() {return signature;} |
86 |
89 |
142 // method in the VM. (All of this contortion is only necessary |
145 // method in the VM. (All of this contortion is only necessary |
143 // because of the "accessibility" bit in AccessibleObject, |
146 // because of the "accessibility" bit in AccessibleObject, |
144 // which implicitly requires that new java.lang.reflect |
147 // which implicitly requires that new java.lang.reflect |
145 // objects be fabricated for each reflective call on Class |
148 // objects be fabricated for each reflective call on Class |
146 // objects.) |
149 // objects.) |
|
150 if (this.root != null) |
|
151 throw new IllegalArgumentException("Can not copy a non-root Method"); |
|
152 |
147 Method res = new Method(clazz, name, parameterTypes, returnType, |
153 Method res = new Method(clazz, name, parameterTypes, returnType, |
148 exceptionTypes, modifiers, slot, signature, |
154 exceptionTypes, modifiers, slot, signature, |
149 annotations, parameterAnnotations, annotationDefault); |
155 annotations, parameterAnnotations, annotationDefault); |
150 res.root = this; |
156 res.root = this; |
151 // Might as well eagerly propagate this if already present |
157 // Might as well eagerly propagate this if already present |
152 res.methodAccessor = methodAccessor; |
158 res.methodAccessor = methodAccessor; |
153 return res; |
159 return res; |
|
160 } |
|
161 |
|
162 /** |
|
163 * Used by Excecutable for annotation sharing. |
|
164 */ |
|
165 @Override |
|
166 Executable getRoot() { |
|
167 return root; |
154 } |
168 } |
155 |
169 |
156 @Override |
170 @Override |
157 boolean hasGenericInformation() { |
171 boolean hasGenericInformation() { |
158 return (getGenericSignature() != null); |
172 return (getGenericSignature() != null); |