I am making a Test annotation, and I want to be able for the user to specify an expected return value.
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Test {
Object value() default null;
Class<? extends Throwable> exception() default NoException.class;
int timeout() default 0;
}
As I know, you cannot specify Object as the return type in annotation methods.
I am wondering if there is a return type which allows primitives AND strings to be returned.
If not, is it possible to create? Thank you.