Type @Retention(RUNTIME) and @Target on a custom annotation
Type @Retention(RUNTIME) and @Target on a custom annotation
Answer
@Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface Audited {}
RUNTIME retention is required for reflection to see the annotation at runtime. @Target(METHOD) limits where it can be applied — the compiler rejects it on a class or field.