Package: groovy.typecheckers

## [Groovy] Class NullChecker

- groovy.typecheckers.NullChecker

-     @Incubating
      class NullChecker
      extends TypeCheckingDSL

  A compile-time type checker that detects potential null dereferences and null-safety violations in code annotated with `@Nullable`, `@NonNull`, and `@MonotonicNonNull` annotations.

  By default, this checker performs annotation-based null checking only. For additional flow-sensitive analysis that tracks nullability through assignments and control flow (even in unannotated code), enable the `strict` option:

       @TypeChecked(extensions = 'groovy.typecheckers.NullChecker(strict: true)')

  Supported annotations are recognized by simple name from any package:

  - Nullable: `@Nullable`, `@CheckForNull`, `@MonotonicNonNull`
  - Non-null: `@NonNull`, `@NotNull`, `@Nonnull`

  Detected errors include:

  - Assigning `null` to a `@NonNull` variable
  - Passing `null` or a `@Nullable` value to a `@NonNull` parameter
  - Returning `null` or a `@Nullable` value from a `@NonNull` method
  - Dereferencing a `@Nullable` variable without a null check or safe navigation (`?.`)
  - Dereferencing the result of a `@Nullable`-returning method without a null check
  - Re-assigning `null` to a `@MonotonicNonNull` field after initialization
  - Dereferencing a variable known to be null through flow analysis (`strict` mode only)

  The checker recognizes null guards (`if (x != null)`), early exit patterns (`if (x == null) return/throw`), and safe navigation (`?.`).

       @TypeChecked(extensions = 'groovy.typecheckers.NullChecker')
       void process(@Nullable String input) {
           // input.length()     // error: potential null dereference
           input?.length()       // ok: safe navigation
           if (input != null) {
               input.length()    // ok: null guard
           }
       }

  Over time, the idea would be to support more cases as per: https://checkerframework.org/manual/#nullness-checker
  Since:
    6.0.0

- - ### Constructor Summary

    Constructors
    Constructor and description
    `NullChecker()`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `Object` | `run()` Registers null-safety checks for each visited method body.

- - ### Constructor Detail

    - #### NullChecker()

  - ### Method Detail

    - #### @Override
      Object run()

      Registers null-safety checks for each visited method body.