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

org.checkerframework.checker.nullness.qual.AssertNonNullIfNonNull 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.44.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;

/**
 * Indicates that if the method returns a non-null value, then the value expressions are also
 * non-null.
 *
 * 

WARNING: Type-checking for this annotation is not implemented at present. * *

Here is an example use: * *


 *    {@literal @}AssertNonNullIfNonNull("id")
 *    {@literal @}Pure
 *     public @Nullable Long getId() {
 *         return id;
 *     }
 * 
* * Note the direction of the implication. This annotation says that if the result is non-null, then * the variable {@code id} is also non-null. The annotation does not say that if {@code id} is * non-null, then the result is non-null. (There is not currently a way to say the latter, though it * would also be useful.) * *

You should not write a formal parameter name or {@code this} as the argument of this * annotation. In those cases, use the {@link PolyNull} annotation instead. * * @see NonNull * @see PolyNull * @see org.checkerframework.checker.nullness.NullnessChecker * @checker_framework.manual #nullness-checker Nullness Checker */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface AssertNonNullIfNonNull { /** * Java expression(s) that are non-null after the method returns a non-null value. * * @checker_framework.manual #java-expressions-as-arguments Syntax of Java expressions */ String[] value(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy