165 }
166
167 /**
168 * Make a copy of a leaf method.
169 */
170 Method leafCopy() {
171 if (this.root == null)
172 throw new IllegalArgumentException("Can only leafCopy a non-root Method");
173
174 Method res = new Method(clazz, name, parameterTypes, returnType,
175 exceptionTypes, modifiers, slot, signature,
176 annotations, parameterAnnotations, annotationDefault);
177 res.root = root;
178 res.methodAccessor = methodAccessor;
179 return res;
180 }
181
182 /**
183 * @throws InaccessibleObjectException {@inheritDoc}
184 * @throws SecurityException {@inheritDoc}
185 */
186 @Override
187 @CallerSensitive
188 public void setAccessible(boolean flag) {
189 AccessibleObject.checkPermission();
190 if (flag) checkCanSetAccessible(Reflection.getCallerClass());
191 setAccessible0(flag);
192 }
193
194 @Override
195 void checkCanSetAccessible(Class<?> caller) {
196 checkCanSetAccessible(caller, clazz);
197 }
198
199 /**
200 * Used by Excecutable for annotation sharing.
201 */
202 @Override
203 Executable getRoot() {
204 return root;
|
165 }
166
167 /**
168 * Make a copy of a leaf method.
169 */
170 Method leafCopy() {
171 if (this.root == null)
172 throw new IllegalArgumentException("Can only leafCopy a non-root Method");
173
174 Method res = new Method(clazz, name, parameterTypes, returnType,
175 exceptionTypes, modifiers, slot, signature,
176 annotations, parameterAnnotations, annotationDefault);
177 res.root = root;
178 res.methodAccessor = methodAccessor;
179 return res;
180 }
181
182 /**
183 * @throws InaccessibleObjectException {@inheritDoc}
184 * @throws SecurityException {@inheritDoc}
185 * @since 9
186 */
187 @Override
188 @CallerSensitive
189 public void setAccessible(boolean flag) {
190 AccessibleObject.checkPermission();
191 if (flag) checkCanSetAccessible(Reflection.getCallerClass());
192 setAccessible0(flag);
193 }
194
195 @Override
196 void checkCanSetAccessible(Class<?> caller) {
197 checkCanSetAccessible(caller, clazz);
198 }
199
200 /**
201 * Used by Excecutable for annotation sharing.
202 */
203 @Override
204 Executable getRoot() {
205 return root;
|