All Downloads are FREE. Search and download functionalities are using the official Maven repository.

checker.src.org.checkerframework.checker.nullness.qual.MonotonicNonNull Maven / Gradle / Ivy

Go to download

The Checker Framework enhances Java’s type system to make it more powerful and useful. This lets software developers detect and prevent errors in their Java programs. The Checker Framework includes compiler plug-ins ("checkers") that find bugs or verify their absence. It also permits you to write your own compiler plug-ins.

There is a newer version: 3.42.0
Show newest version
package org.checkerframework.checker.nullness.qual;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.checkerframework.checker.nullness.AbstractNullnessChecker;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
import org.checkerframework.framework.qual.MonotonicQualifier;
import org.checkerframework.framework.qual.SubtypeOf;

/**
 * Indicates that a field (or variable) is lazily initialized to a non-null
 * value.  Once the field becomes non-null, it never becomes null again.
 * There is no guarantee that the field ever becomes non-null, but if it
 * does, it will stay non-null.
 * 

* * A monotonically non-null field has these two properties: *

    *
  1. The field may be assigned only non-null values.
  2. *
  3. The field may be re-assigned as often as desired.
  4. *
*

* * When the field is first read within a method, the field cannot be * assumed to be non-null. After a check that a {@code MonotonicNonNull} field * holds a non-null value, all subsequent accesses within that * method can be assumed to be non-null, even after arbitrary external * method calls that might access the field. *

* * {@code MonotonicNonNull} gives stronger guarantees than {@link Nullable}. * After a check that a {@link Nullable} field holds a non-null value, only * accesses until the next non-{@link org.checkerframework.dataflow.qual.SideEffectFree} method is called can be assumed * to be non-null. *

* * To indicate that a {@code MonotonicNonNull} or {@code Nullable} field is * non-null whenever a particular method is called, use * {@link RequiresNonNull}. *

* * Final fields are treated as MonotonicNonNull by default. *

* * This annotation is associated with the {@link AbstractNullnessChecker}. * * @see EnsuresNonNull * @see RequiresNonNull * @see MonotonicQualifier * @see AbstractNullnessChecker * @checker_framework.manual #nullness-checker Nullness Checker */ @Documented @SubtypeOf(Nullable.class) @Target(ElementType.TYPE_USE) @MonotonicQualifier(NonNull.class) @Retention(RetentionPolicy.RUNTIME) public @interface MonotonicNonNull { }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy