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

checker.src.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.42.0
Show newest version
package org.checkerframework.checker.nullness.qual;

import org.checkerframework.checker.nullness.NullnessChecker;

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: * *

     @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 id is also non-null. The * annotation does not say that if 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 this * as the argument of this annotation. In those cases, use the {@link * PolyNull} annotation instead. * * @see NonNull * @see PolyNull * @see 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 vlue. * @checker_framework.manual #java-expressions-as-arguments Syntax of Java expressions */ String[] value(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy