reopen top-level constant

_Reopen const reopen

Annotation for intentionally loosening restrictions on subtyping that would otherwise cause lint warnings to be produced by the implicit_reopen lint.

Indicates that the annotated class, mixin, or mixin class declaration intentionally allows subtypes outside the library to implement it, or extend it, or mix it in, even though it has some superinterfaces whose restrictions prevent inheritance.

A class, mixin, or mixin class declaration prevents inheritance if:

  • it is marked interface or final
  • it is marked sealed, and is implicitly interface or final based on the modifiers of its superinterfaces
  • it is an anonymous mixin application, and is implicitly interface or final based on the modifiers of its superinterfaces

A declaration annotated with @reopen will suppress warnings from the implicit_reopen lint. That lint will otherwise warn when a subtype has restrictions that are not sufficient to enforce the restrictions declared by class modifiers on one or more superinterfaces.

In addition, tools, such as the analyzer, can provide feedback if

  • The annotation is applied to anything other than a class, mixin, or mixin class.
  • The annotation is applied to a class or mixin which does not require it. (The intent to reopen was not satisfied.)

Implementation

const _Reopen reopen = _Reopen();