Annotation Interface OptIn
@Documented
@Repeatable(OptIn.Repeated.class)
@Retention(RUNTIME)
@Target({CONSTRUCTOR,FIELD,METHOD,MODULE,PACKAGE,TYPE})
public @interface OptIn
An element annotated
OptIn explicitly opts in into APIs annotated with a specified marker
annotation.
The exact semantics differ depending on the type of the annotated element:
- Annotating a declaration allows using APIs typically requiring to be marked with the same marker annotation to be used in the declaration's spanned scope. Similarly, the requirement is not propagated to the declaration's use-sites.
- Annotating a package allows using APIs typically requiring to be marked with the same marker annotation in all compilation units belonging to the package in a compilation.
- Since:
- 0.1.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceA container for therepeatableOptInannotation. -
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionClass<? extends Annotation> Returns themarker annotationof the API to opt-in into.
-
Element Details
-
value
Class<? extends Annotation> valueReturns themarker annotationof the API to opt-in into.- Returns:
- the
marker annotationof the API to opt-in into - Since:
- 0.1.0
-