Class NullnessChecker

  • All Implemented Interfaces:
    javax.annotation.processing.Processor, OptionConfiguration

    @SupportedLintOptions({"noInitForMonotonicNonNull","redundantNullComparison","soundArrayCreationNullness","forbidnonnullarraycomponents","trustArrayLenZero","permitClearProperty"})
    @SupportedOptions({"assumeKeyFor","assumeInitialized","jspecifyNullMarkedAlias","conservativeArgumentNullnessAfterInvocation"})
    @StubFiles("junit-assertions.astub")
    public class NullnessChecker
    extends InitializationChecker
    An implementation of the nullness type-system, parameterized by an initialization type-system for safe initialization. It uses freedom-before-commitment, augmented by type frames (which are crucial to obtain acceptable precision), as its initialization type system.

    This checker uses the NullnessNoInitSubchecker to check for nullness and extends the InitializationChecker to also check that all non-null fields are properly initialized.

    You can use the following SuppressWarnings prefixes with this checker:

    • @SuppressWarnings("nullness") suppresses warnings for both nullness and initialization annotations
    • @SuppressWarnings("initialization") suppresses warnings for initialization annotations only
    • @SuppressWarnings("nullnessnoinit") suppresses warnings for nullness annotations only
    See Also:
    KeyForSubchecker, InitializationChecker, NullnessNoInitSubchecker
    See the Checker Framework Manual:
    Nullness Checker
    • Field Detail

      • LINT_NOINITFORMONOTONICNONNULL

        public static final java.lang.String LINT_NOINITFORMONOTONICNONNULL
        Should we be strict about initialization of MonotonicNonNull variables?
        See Also:
        Constant Field Values
      • LINT_REDUNDANTNULLCOMPARISON

        public static final java.lang.String LINT_REDUNDANTNULLCOMPARISON
        Warn about redundant comparisons of an expression with null, if the expression is known to be non-null.
        See Also:
        Constant Field Values
      • LINT_TRUSTARRAYLENZERO

        public static final java.lang.String LINT_TRUSTARRAYLENZERO
        Should the Nullness Checker unsoundly trust @ArrayLen(0) annotations to improve handling of Collection.toArray() by CollectionToArrayHeuristics?
        See Also:
        Constant Field Values
      • LINT_PERMITCLEARPROPERTY

        public static final java.lang.String LINT_PERMITCLEARPROPERTY
        If true, client code may clear system properties. If false (the default), some calls to System.getProperty are refined to return @NonNull.
        See Also:
        Constant Field Values
    • Constructor Detail

      • NullnessChecker

        public NullnessChecker()
        Default constructor for NullnessChecker.