Annotation 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 Classes
    Modifier and Type
    Class
    Description
    static @interface 
    A container for the repeatable OptIn annotation.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Class<? extends Annotation>
    Returns the marker annotation of the API to opt-in into.