Annotation Type Initializer
-
@Retention(CLASS) @Target(METHOD) public @interface InitializerAn annotation used to mark a method as an initializer.During initialization checking (see NullAway Wiki), NullAway considers a method marked with any annotation with simple name
@Initializerto denote an initializer method. Initializer methods are assumed by NullAway to always be called before any other method of the class that is not a constructor or called from a constructor. This means a non-null field is considered to be properly initialized if it's set by such an initializer method. By design, NullAway doesn't check for such initialization, since an important use case of initializer methods is documenting methods used by annotation processors or external frameworks as part of object set up (e.g.android.app.Activity.onCreateorjavax.annotation.processing.Processor.init). Note that there are other ways of defining initializer methods from external libraries (i.e. library models), and that a method overriding an initializer method is always considered an initializer method (again, for the sake of framework events such asonCreate).