200 public abstract String getName();
201
202 /**
203 * Returns the Java language {@linkplain Modifier modifiers} for
204 * the executable represented by this object.
205 */
206 public abstract int getModifiers();
207
208 /**
209 * Returns an array of {@code TypeVariable} objects that represent the
210 * type variables declared by the generic declaration represented by this
211 * {@code GenericDeclaration} object, in declaration order. Returns an
212 * array of length 0 if the underlying generic declaration declares no type
213 * variables.
214 *
215 * @return an array of {@code TypeVariable} objects that represent
216 * the type variables declared by this generic declaration
217 * @throws GenericSignatureFormatError if the generic
218 * signature of this generic declaration does not conform to
219 * the format specified in
220 * <cite>The Java™ Virtual Machine Specification</cite>
221 */
222 public abstract TypeVariable<?>[] getTypeParameters();
223
224 // returns shared array of parameter types - must never give it out
225 // to the untrusted code...
226 abstract Class<?>[] getSharedParameterTypes();
227
228 // returns shared array of exception types - must never give it out
229 // to the untrusted code...
230 abstract Class<?>[] getSharedExceptionTypes();
231
232 /**
233 * Returns an array of {@code Class} objects that represent the formal
234 * parameter types, in declaration order, of the executable
235 * represented by this object. Returns an array of length
236 * 0 if the underlying executable takes no parameters.
237 * Note that the constructors of some inner classes
238 * may have an implicitly declared parameter in addition to
239 * explicitly declared ones.
240 *
259 * Returns an array of {@code Type} objects that represent the formal
260 * parameter types, in declaration order, of the executable represented by
261 * this object. Returns an array of length 0 if the
262 * underlying executable takes no parameters.
263 * Note that the constructors of some inner classes
264 * may have an implicitly declared parameter in addition to
265 * explicitly declared ones.
266 *
267 * <p>If a formal parameter type is a parameterized type,
268 * the {@code Type} object returned for it must accurately reflect
269 * the actual type arguments used in the source code.
270 *
271 * <p>If a formal parameter type is a type variable or a parameterized
272 * type, it is created. Otherwise, it is resolved.
273 *
274 * @return an array of {@code Type}s that represent the formal
275 * parameter types of the underlying executable, in declaration order
276 * @throws GenericSignatureFormatError
277 * if the generic method signature does not conform to the format
278 * specified in
279 * <cite>The Java™ Virtual Machine Specification</cite>
280 * @throws TypeNotPresentException if any of the parameter
281 * types of the underlying executable refers to a non-existent type
282 * declaration
283 * @throws MalformedParameterizedTypeException if any of
284 * the underlying executable's parameter types refer to a parameterized
285 * type that cannot be instantiated for any reason
286 */
287 public Type[] getGenericParameterTypes() {
288 if (hasGenericInformation())
289 return getGenericInfo().getParameterTypes();
290 else
291 return getParameterTypes();
292 }
293
294 /**
295 * Behaves like {@code getGenericParameterTypes}, but returns type
296 * information for all parameters, including synthetic parameters.
297 */
298 Type[] getAllGenericParameterTypes() {
299 final boolean genericInfo = hasGenericInformation();
457 *
458 * @return the exception types declared as being thrown by the
459 * executable this object represents
460 */
461 public abstract Class<?>[] getExceptionTypes();
462
463 /**
464 * Returns an array of {@code Type} objects that represent the
465 * exceptions declared to be thrown by this executable object.
466 * Returns an array of length 0 if the underlying executable declares
467 * no exceptions in its {@code throws} clause.
468 *
469 * <p>If an exception type is a type variable or a parameterized
470 * type, it is created. Otherwise, it is resolved.
471 *
472 * @return an array of Types that represent the exception types
473 * thrown by the underlying executable
474 * @throws GenericSignatureFormatError
475 * if the generic method signature does not conform to the format
476 * specified in
477 * <cite>The Java™ Virtual Machine Specification</cite>
478 * @throws TypeNotPresentException if the underlying executable's
479 * {@code throws} clause refers to a non-existent type declaration
480 * @throws MalformedParameterizedTypeException if
481 * the underlying executable's {@code throws} clause refers to a
482 * parameterized type that cannot be instantiated for any reason
483 */
484 public Type[] getGenericExceptionTypes() {
485 Type[] result;
486 if (hasGenericInformation() &&
487 ((result = getGenericInfo().getExceptionTypes()).length > 0))
488 return result;
489 else
490 return getExceptionTypes();
491 }
492
493 /**
494 * Returns a string describing this {@code Executable}, including
495 * any type parameters.
496 * @return a string describing this {@code Executable}, including
497 * any type parameters
498 */
499 public abstract String toGenericString();
500
501 /**
502 * Returns {@code true} if this executable was declared to take a
503 * variable number of arguments; returns {@code false} otherwise.
504 *
505 * @return {@code true} if an only if this executable was declared
506 * to take a variable number of arguments.
507 */
508 public boolean isVarArgs() {
509 return (getModifiers() & Modifier.VARARGS) != 0;
510 }
511
512 /**
513 * Returns {@code true} if this executable is a synthetic
514 * construct; returns {@code false} otherwise.
515 *
516 * @return true if and only if this executable is a synthetic
517 * construct as defined by
518 * <cite>The Java™ Language Specification</cite>.
519 * @jls 13.1 The Form of a Binary
520 */
521 public boolean isSynthetic() {
522 return Modifier.isSynthetic(getModifiers());
523 }
524
525 /**
526 * Returns an array of arrays of {@code Annotation}s that
527 * represent the annotations on the formal parameters, in
528 * declaration order, of the {@code Executable} represented by
529 * this object. Synthetic and mandated parameters (see
530 * explanation below), such as the outer "this" parameter to an
531 * inner class constructor will be represented in the returned
532 * array. If the executable has no parameters (meaning no formal,
533 * no synthetic, and no mandated parameters), a zero-length array
534 * will be returned. If the {@code Executable} has one or more
535 * parameters, a nested array of length zero is returned for each
536 * parameter with no annotations. The annotation objects contained
537 * in the returned arrays are serializable. The caller of this
538 * method is free to modify the returned arrays; it will have no
|
200 public abstract String getName();
201
202 /**
203 * Returns the Java language {@linkplain Modifier modifiers} for
204 * the executable represented by this object.
205 */
206 public abstract int getModifiers();
207
208 /**
209 * Returns an array of {@code TypeVariable} objects that represent the
210 * type variables declared by the generic declaration represented by this
211 * {@code GenericDeclaration} object, in declaration order. Returns an
212 * array of length 0 if the underlying generic declaration declares no type
213 * variables.
214 *
215 * @return an array of {@code TypeVariable} objects that represent
216 * the type variables declared by this generic declaration
217 * @throws GenericSignatureFormatError if the generic
218 * signature of this generic declaration does not conform to
219 * the format specified in
220 * <cite>The Java Virtual Machine Specification</cite>
221 */
222 public abstract TypeVariable<?>[] getTypeParameters();
223
224 // returns shared array of parameter types - must never give it out
225 // to the untrusted code...
226 abstract Class<?>[] getSharedParameterTypes();
227
228 // returns shared array of exception types - must never give it out
229 // to the untrusted code...
230 abstract Class<?>[] getSharedExceptionTypes();
231
232 /**
233 * Returns an array of {@code Class} objects that represent the formal
234 * parameter types, in declaration order, of the executable
235 * represented by this object. Returns an array of length
236 * 0 if the underlying executable takes no parameters.
237 * Note that the constructors of some inner classes
238 * may have an implicitly declared parameter in addition to
239 * explicitly declared ones.
240 *
259 * Returns an array of {@code Type} objects that represent the formal
260 * parameter types, in declaration order, of the executable represented by
261 * this object. Returns an array of length 0 if the
262 * underlying executable takes no parameters.
263 * Note that the constructors of some inner classes
264 * may have an implicitly declared parameter in addition to
265 * explicitly declared ones.
266 *
267 * <p>If a formal parameter type is a parameterized type,
268 * the {@code Type} object returned for it must accurately reflect
269 * the actual type arguments used in the source code.
270 *
271 * <p>If a formal parameter type is a type variable or a parameterized
272 * type, it is created. Otherwise, it is resolved.
273 *
274 * @return an array of {@code Type}s that represent the formal
275 * parameter types of the underlying executable, in declaration order
276 * @throws GenericSignatureFormatError
277 * if the generic method signature does not conform to the format
278 * specified in
279 * <cite>The Java Virtual Machine Specification</cite>
280 * @throws TypeNotPresentException if any of the parameter
281 * types of the underlying executable refers to a non-existent type
282 * declaration
283 * @throws MalformedParameterizedTypeException if any of
284 * the underlying executable's parameter types refer to a parameterized
285 * type that cannot be instantiated for any reason
286 */
287 public Type[] getGenericParameterTypes() {
288 if (hasGenericInformation())
289 return getGenericInfo().getParameterTypes();
290 else
291 return getParameterTypes();
292 }
293
294 /**
295 * Behaves like {@code getGenericParameterTypes}, but returns type
296 * information for all parameters, including synthetic parameters.
297 */
298 Type[] getAllGenericParameterTypes() {
299 final boolean genericInfo = hasGenericInformation();
457 *
458 * @return the exception types declared as being thrown by the
459 * executable this object represents
460 */
461 public abstract Class<?>[] getExceptionTypes();
462
463 /**
464 * Returns an array of {@code Type} objects that represent the
465 * exceptions declared to be thrown by this executable object.
466 * Returns an array of length 0 if the underlying executable declares
467 * no exceptions in its {@code throws} clause.
468 *
469 * <p>If an exception type is a type variable or a parameterized
470 * type, it is created. Otherwise, it is resolved.
471 *
472 * @return an array of Types that represent the exception types
473 * thrown by the underlying executable
474 * @throws GenericSignatureFormatError
475 * if the generic method signature does not conform to the format
476 * specified in
477 * <cite>The Java Virtual Machine Specification</cite>
478 * @throws TypeNotPresentException if the underlying executable's
479 * {@code throws} clause refers to a non-existent type declaration
480 * @throws MalformedParameterizedTypeException if
481 * the underlying executable's {@code throws} clause refers to a
482 * parameterized type that cannot be instantiated for any reason
483 */
484 public Type[] getGenericExceptionTypes() {
485 Type[] result;
486 if (hasGenericInformation() &&
487 ((result = getGenericInfo().getExceptionTypes()).length > 0))
488 return result;
489 else
490 return getExceptionTypes();
491 }
492
493 /**
494 * Returns a string describing this {@code Executable}, including
495 * any type parameters.
496 * @return a string describing this {@code Executable}, including
497 * any type parameters
498 */
499 public abstract String toGenericString();
500
501 /**
502 * Returns {@code true} if this executable was declared to take a
503 * variable number of arguments; returns {@code false} otherwise.
504 *
505 * @return {@code true} if an only if this executable was declared
506 * to take a variable number of arguments.
507 */
508 public boolean isVarArgs() {
509 return (getModifiers() & Modifier.VARARGS) != 0;
510 }
511
512 /**
513 * Returns {@code true} if this executable is a synthetic
514 * construct; returns {@code false} otherwise.
515 *
516 * @return true if and only if this executable is a synthetic
517 * construct as defined by
518 * <cite>The Java Language Specification</cite>.
519 * @jls 13.1 The Form of a Binary
520 */
521 public boolean isSynthetic() {
522 return Modifier.isSynthetic(getModifiers());
523 }
524
525 /**
526 * Returns an array of arrays of {@code Annotation}s that
527 * represent the annotations on the formal parameters, in
528 * declaration order, of the {@code Executable} represented by
529 * this object. Synthetic and mandated parameters (see
530 * explanation below), such as the outer "this" parameter to an
531 * inner class constructor will be represented in the returned
532 * array. If the executable has no parameters (meaning no formal,
533 * no synthetic, and no mandated parameters), a zero-length array
534 * will be returned. If the {@code Executable} has one or more
535 * parameters, a nested array of length zero is returned for each
536 * parameter with no annotations. The annotation objects contained
537 * in the returned arrays are serializable. The caller of this
538 * method is free to modify the returned arrays; it will have no
|