For inspecting the annotations of a method return, we need to call the getAnnotatedReturnType() method:
This method returns the annotated return type of the given method:
Class<Melon> clazz = Melon.class;
Method methodSeeds = clazz.getDeclaredMethod("seeds");
AnnotatedType returnType = methodSeeds.getAnnotatedReturnType();
// java.util.List<modern.challenge.Seed>
System.out.println("Return type: "
+ returnType.getType().getTypeName());
// [@modern.challenge.Shape(value="oval")]
System.out.println("Annotations of the return type: "
+ Arrays.toString(returnType.getAnnotations()));