575 *
576 * Returns an AnnotatedType object that represents the use of a type to
577 * specify the return type of the method/constructor represented by this
578 * Executable.
579 *
580 * @since 1.8
581 */
582 AnnotatedType getAnnotatedReturnType0(Type returnType) {
583 return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
584 sun.misc.SharedSecrets.getJavaLangAccess().
585 getConstantPool(getDeclaringClass()),
586 this,
587 getDeclaringClass(),
588 returnType,
589 TypeAnnotation.TypeAnnotationTarget.METHOD_RETURN);
590 }
591
592 /**
593 * Returns an {@code AnnotatedType} object that represents the use of a
594 * type to specify the receiver type of the method/constructor represented
595 * by this Executable object. The receiver type of a method/constructor is
596 * available only if the method/constructor has a <em>receiver
597 * parameter</em> (JLS 8.4.1).
598 *
599 * If this {@code Executable} object represents a constructor or instance
600 * method that does not have a receiver parameter, or has a receiver
601 * parameter with no annotations on its type, then the return value is an
602 * {@code AnnotatedType} object representing an element with no
603 * annotations.
604 *
605 * If this {@code Executable} object represents a static method, then the
606 * return value is null.
607 *
608 * @return an object representing the receiver type of the method or
609 * constructor represented by this {@code Executable}
610 *
611 * @since 1.8
612 */
613 public AnnotatedType getAnnotatedReceiverType() {
614 if (Modifier.isStatic(this.getModifiers()))
615 return null;
616 return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
617 sun.misc.SharedSecrets.getJavaLangAccess().
618 getConstantPool(getDeclaringClass()),
619 this,
620 getDeclaringClass(),
621 getDeclaringClass(),
622 TypeAnnotation.TypeAnnotationTarget.METHOD_RECEIVER);
623 }
624
625 /**
626 * Returns an array of {@code AnnotatedType} objects that represent the use
627 * of types to specify formal parameter types of the method/constructor
628 * represented by this Executable. The order of the objects in the array
629 * corresponds to the order of the formal parameter types in the
|
575 *
576 * Returns an AnnotatedType object that represents the use of a type to
577 * specify the return type of the method/constructor represented by this
578 * Executable.
579 *
580 * @since 1.8
581 */
582 AnnotatedType getAnnotatedReturnType0(Type returnType) {
583 return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
584 sun.misc.SharedSecrets.getJavaLangAccess().
585 getConstantPool(getDeclaringClass()),
586 this,
587 getDeclaringClass(),
588 returnType,
589 TypeAnnotation.TypeAnnotationTarget.METHOD_RETURN);
590 }
591
592 /**
593 * Returns an {@code AnnotatedType} object that represents the use of a
594 * type to specify the receiver type of the method/constructor represented
595 * by this {@code Executable} object.
596 *
597 * The receiver type of a method/constructor is available only if the
598 * method/constructor has a receiver parameter (JLS 8.4.1). If this {@code
599 * Executable} object <em>represents an instance method or represents a
600 * constructor of an inner member class</em>, and the
601 * method/constructor <em>either</em> has no receiver parameter or has a
602 * receiver parameter with no annotations on its type, then the return
603 * value is an {@code AnnotatedType} object representing an element with no
604 * annotations.
605 *
606 * If this {@code Executable} object represents a static method or
607 * represents a constructor of a top level, static member, local, or
608 * anoymous class, then the return value is null.
609 *
610 * @return an object representing the receiver type of the method or
611 * constructor represented by this {@code Executable} or {@code null} if
612 * this {@code Executable} can not have a receiver parameter
613 *
614 * @since 1.8
615 */
616 public AnnotatedType getAnnotatedReceiverType() {
617 if (Modifier.isStatic(this.getModifiers()))
618 return null;
619 return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
620 sun.misc.SharedSecrets.getJavaLangAccess().
621 getConstantPool(getDeclaringClass()),
622 this,
623 getDeclaringClass(),
624 getDeclaringClass(),
625 TypeAnnotation.TypeAnnotationTarget.METHOD_RECEIVER);
626 }
627
628 /**
629 * Returns an array of {@code AnnotatedType} objects that represent the use
630 * of types to specify formal parameter types of the method/constructor
631 * represented by this Executable. The order of the objects in the array
632 * corresponds to the order of the formal parameter types in the
|