To avoid the need to write the NullnessUtil class name, do:
import static org.checkerframework.checker.nullness.util.NullnessUtil.castNonNull;
or
import static org.checkerframework.checker.nullness.util.NullnessUtil.*;
Runtime Dependency: If you use this class, you must distribute (or link to) checker-qual.jar, along with your binaries. Or, you can copy this class into your own project.
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static < the type of the reference T extends @Nullable Object> @NonNull T | Returns: the argument, casted to have the type qualifier @NonNulla reference of @Nullable type, that is non-null at run time ref)A method that suppresses warnings from the Nullness Checker. |
| public static < the type of the reference T extends @Nullable Object> @NonNull T | Returns: the argument, casted to have the type qualifier @NonNulla reference of @Nullable type, that is non-null at run time ref, String text to include if this method is misused message)Suppress warnings from the Nullness Checker, with a custom error message. |
| private static < the component type (five levels in) of the array T extends @Nullable Object> @NonNull @NonNull T[] | Returns: the argument, casted to have the type qualifier @NonNull at all levelsan array all of whose elements, and their elements recursively, are non-null at run
time arr, @Nullable String text to include if there is a non-null value, or null to use uncustomized
message message)The implementation of castNonNullDeep. |
| public static < the component type of the array T extends @Nullable Object> @NonNull @NonNull T[] | Returns: the argument, casted to have the type qualifier @NonNull at all levelsan array all of whose elements, and their elements recursively, are non-null at run
time arr)Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. |
| public static < the component type of the array T extends @Nullable Object> @NonNull @NonNull T[] | Returns: the argument, casted to have the type qualifier @NonNull at all levelsan array all of whose elements, and their elements recursively, are non-null at run
time arr, String text to include if this method is misused message)Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. |
| public static < the component type of the component type of the array T extends @Nullable Object> @NonNull @NonNull T[][] | Returns: the argument, casted to have the type qualifier @NonNull at all levelsan array all of whose elements, and their elements recursively, are non-null at run
time arr)Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. |
| public static < the component type of the component type of the array T extends @Nullable Object> @NonNull @NonNull T[][] | Returns: the argument, casted to have the type qualifier @NonNull at all levelsan array all of whose elements, and their elements recursively, are non-null at run
time arr, String text to include if this method is misused message)Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. |
| public static < the component type (three levels in) of the array T extends @Nullable Object> @NonNull @NonNull T[][][] | Returns: the argument, casted to have the type qualifier @NonNull at all levelsan array all of whose elements, and their elements recursively, are non-null at run
time arr)Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. |
| public static < the component type (three levels in) of the array T extends @Nullable Object> @NonNull @NonNull T[][][] | Returns: the argument, casted to have the type qualifier @NonNull at all levelsan array all of whose elements, and their elements recursively, are non-null at run
time arr, String text to include if this method is misused message)Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. |
| public static < the component type of the array T extends @Nullable Object> @NonNull @NonNull T[][][][] | Returns: the argument, casted to have the type qualifier @NonNull at all levelsan array all of whose elements, and their elements recursively, are non-null at run
time arr)Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. |
| public static < the component type (four levels in) of the array T extends @Nullable Object> @NonNull @NonNull T[][][][] | Returns: the argument, casted to have the type qualifier @NonNull at all levelsan array all of whose elements, and their elements recursively, are non-null at run
time arr, String text to include if this method is misused message)Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. |
| public static < the component type (four levels in) of the array T extends @Nullable Object> @NonNull @NonNull T[][][][][] | Returns: the argument, casted to have the type qualifier @NonNull at all levelsan array all of whose elements, and their elements recursively, are non-null at run
time arr)Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. |
| public static < the component type (five levels in) of the array T extends @Nullable Object> @NonNull @NonNull T[][][][][] | Returns: the argument, casted to have the type qualifier @NonNull at all levelsan array all of whose elements, and their elements recursively, are non-null at run
time arr, String text to include if this method is misused message)Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. |
| private static void | checkIfArray(@NonNull Object
a value; if an array, all of its elements, and their elements recursively, are
non-null at run time ref, @Nullable String text to include if there is a non-null value, or null to use uncustomized
message message)If the argument is an array, requires it to be non-null at all levels. |
| NullnessUtil | back to summary |
|---|---|
| private NullnessUtil() | |
| castNonNull | back to summary |
|---|---|
| public static <T extends @Nullable Object> @NonNull T castNonNull(@Nullable T ref) A method that suppresses warnings from the Nullness Checker. The method takes a possibly-null reference, unsafely casts it to have the @NonNull type
qualifier, and returns it. The Nullness Checker considers both the return value, and also the
argument, to be non-null after the method call. Therefore, the
The The method throws | |
| castNonNull | back to summary |
|---|---|
| public static <T extends @Nullable Object> @NonNull T castNonNull(@Nullable T ref, String message) Suppress warnings from the Nullness Checker, with a custom error message. See
| |
| castNonNullArray | back to summary |
|---|---|
| private static <T extends @Nullable Object> @NonNull @NonNull T[] castNonNullArray(@Nullable T[] arr, @Nullable String message) The implementation of castNonNullDeep. | |
| castNonNullDeep | back to summary |
|---|---|
| public static <T extends @Nullable Object> @NonNull @NonNull T[] castNonNullDeep(@Nullable T[] arr) Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. The array is recursively checked to ensure that all elements at every array level are non-null.
| |
| castNonNullDeep | back to summary |
|---|---|
| public static <T extends @Nullable Object> @NonNull @NonNull T[] castNonNullDeep(@Nullable T[] arr, String message) Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. The array is recursively checked to ensure that all elements at every array level are non-null.
| |
| castNonNullDeep | back to summary |
|---|---|
| public static <T extends @Nullable Object> @NonNull @NonNull T[][] castNonNullDeep(@Nullable @Nullable T[][] arr) Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. The array is recursively checked to ensure that all elements at every array level are non-null.
| |
| castNonNullDeep | back to summary |
|---|---|
| public static <T extends @Nullable Object> @NonNull @NonNull T[][] castNonNullDeep(@Nullable @Nullable T[][] arr, String message) Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. The array is recursively checked to ensure that all elements at every array level are non-null.
| |
| castNonNullDeep | back to summary |
|---|---|
| public static <T extends @Nullable Object> @NonNull @NonNull T[][][] castNonNullDeep(@Nullable @Nullable @Nullable T[][][] arr) Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. The array is recursively checked to ensure that all elements at every array level are non-null.
| |
| castNonNullDeep | back to summary |
|---|---|
| public static <T extends @Nullable Object> @NonNull @NonNull T[][][] castNonNullDeep(@Nullable @Nullable @Nullable T[][][] arr, String message) Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. The array is recursively checked to ensure that all elements at every array level are non-null.
| |
| castNonNullDeep | back to summary |
|---|---|
| public static <T extends @Nullable Object> @NonNull @NonNull T[][][][] castNonNullDeep(@Nullable @Nullable @Nullable @Nullable T[][][][] arr) Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. The array is recursively checked to ensure that all elements at every array level are non-null.
| |
| castNonNullDeep | back to summary |
|---|---|
| public static <T extends @Nullable Object> @NonNull @NonNull T[][][][] castNonNullDeep(@Nullable @Nullable @Nullable @Nullable T[][][][] arr, String message) Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. The array is recursively checked to ensure that all elements at every array level are non-null.
| |
| castNonNullDeep | back to summary |
|---|---|
| public static <T extends @Nullable Object> @NonNull @NonNull T[][][][][] castNonNullDeep(@Nullable @Nullable @Nullable @Nullable @Nullable T[][][][][] arr) Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. The array is recursively checked to ensure that all elements at every array level are non-null.
| |
| castNonNullDeep | back to summary |
|---|---|
| public static <T extends @Nullable Object> @NonNull @NonNull T[][][][][] castNonNullDeep(@Nullable @Nullable @Nullable @Nullable @Nullable T[][][][][] arr, String message) Like castNonNull, but whereas that method only checks and casts the reference itself, this traverses all levels of the argument array. The array is recursively checked to ensure that all elements at every array level are non-null.
| |
| checkIfArray | back to summary |
|---|---|
| private static void checkIfArray(@NonNull Object ref, @Nullable String message) If the argument is an array, requires it to be non-null at all levels. | |