package checkers.nullness.quals; import java.lang.annotation.*; import javax.lang.model.type.TypeKind; import checkers.nullness.NullnessChecker; import checkers.quals.ImplicitFor; import checkers.quals.SubtypeOf; import checkers.quals.TypeQualifier; import checkers.types.AnnotatedTypeMirror.AnnotatedPrimitiveType; import com.sun.source.tree.Tree; /** * Indicates that a variable should never have a null value. * <p> * * This annotation is rarely written in source code, because it is the default. * <p> * * This annotation is associated with the {@link NullnessChecker}. * * @see Nullable * @see NullnessChecker * @checker.framework.manual #nullness-checker Nullness Checker */ @Documented @Retention(RetentionPolicy.RUNTIME) //@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @TypeQualifier @SubtypeOf( LazyNonNull.class ) @ImplicitFor( types={TypeKind.PACKAGE}, typeClasses={AnnotatedPrimitiveType.class}, trees={ Tree.Kind.NEW_CLASS, Tree.Kind.NEW_ARRAY, Tree.Kind.PLUS, // for String concatenation // All literals except NULL_LITERAL: Tree.Kind.BOOLEAN_LITERAL, Tree.Kind.CHAR_LITERAL, Tree.Kind.DOUBLE_LITERAL, Tree.Kind.FLOAT_LITERAL, Tree.Kind.INT_LITERAL, Tree.Kind.LONG_LITERAL, Tree.Kind.STRING_LITERAL }) public @interface NonNull { }