459 /** 460 * {@inheritDoc} 461 */ 462 public Annotation[] getDeclaredAnnotations() { 463 return AnnotationParser.toArray(declaredAnnotations()); 464 } 465 466 private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations; 467 468 private synchronized Map<Class<? extends Annotation>, Annotation> declaredAnnotations() { 469 if (declaredAnnotations == null) { 470 declaredAnnotations = AnnotationParser.parseAnnotations( 471 getAnnotationBytes(), 472 sun.misc.SharedSecrets.getJavaLangAccess(). 473 getConstantPool(getDeclaringClass()), 474 getDeclaringClass()); 475 } 476 return declaredAnnotations; 477 } 478 479 480 /* Helper for subclasses of Executable. 481 * 482 * Returns an AnnotatedType object that represents the use of a type to 483 * specify the return type of the method/constructor represented by this 484 * Executable. 485 * 486 * @since 1.8 487 */ 488 AnnotatedType getAnnotatedReturnType0(Type returnType) { 489 return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes(), 490 sun.misc.SharedSecrets.getJavaLangAccess(). 491 getConstantPool(getDeclaringClass()), 492 this, 493 getDeclaringClass(), 494 returnType, 495 TypeAnnotation.TypeAnnotationTarget.METHOD_RETURN_TYPE); 496 } 497 498 /** | 459 /** 460 * {@inheritDoc} 461 */ 462 public Annotation[] getDeclaredAnnotations() { 463 return AnnotationParser.toArray(declaredAnnotations()); 464 } 465 466 private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations; 467 468 private synchronized Map<Class<? extends Annotation>, Annotation> declaredAnnotations() { 469 if (declaredAnnotations == null) { 470 declaredAnnotations = AnnotationParser.parseAnnotations( 471 getAnnotationBytes(), 472 sun.misc.SharedSecrets.getJavaLangAccess(). 473 getConstantPool(getDeclaringClass()), 474 getDeclaringClass()); 475 } 476 return declaredAnnotations; 477 } 478 479 /** 480 * Returns an AnnotatedType object that represents the potentially 481 * annotated return type of the method/constructor represented by this 482 * Executable. 483 * 484 * If this Executable represents a constructor, the AnnotatedType object 485 * represents the type of the constructed object. 486 * 487 * If this Executable represents a method, the AnnotatedType object 488 * represents the use of a type to specify the return type of the method. 489 * 490 * @since 1.8 491 */ 492 public abstract AnnotatedType getAnnotatedReturnType(); 493 494 /* Helper for subclasses of Executable. 495 * 496 * Returns an AnnotatedType object that represents the use of a type to 497 * specify the return type of the method/constructor represented by this 498 * Executable. 499 * 500 * @since 1.8 501 */ 502 AnnotatedType getAnnotatedReturnType0(Type returnType) { 503 return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes(), 504 sun.misc.SharedSecrets.getJavaLangAccess(). 505 getConstantPool(getDeclaringClass()), 506 this, 507 getDeclaringClass(), 508 returnType, 509 TypeAnnotation.TypeAnnotationTarget.METHOD_RETURN_TYPE); 510 } 511 512 /** |