是否可以为其他注释类型的注释字段指定默认值?

Rom*_*man 6 java annotations jls

public @interface InnerAnnotation {
    String value() default "hello";
}

public @interface OuterAnnotation {
    InnerAnnotation value() default ???
}
Run Code Online (Sandbox Code Playgroud)

还有一种情况

public @interface AnotherOuterAnnotation {
    InnerAnnotation[] value() default ??? UPD: {} 
}
Run Code Online (Sandbox Code Playgroud)

Per*_*ion 10

是的,它可能:

public @interface InnerAnnotation {
    String value() default "hello";
}

public @interface OuterAnnotation {
    InnerAnnotation value() default @InnerAnnotation(value = "Goodbye");
}
Run Code Online (Sandbox Code Playgroud)