001package io.avaje.lang;
002
003import java.lang.annotation.Documented;
004import java.lang.annotation.ElementType;
005import java.lang.annotation.Retention;
006import java.lang.annotation.RetentionPolicy;
007import java.lang.annotation.Target;
008
009import javax.annotation.Nonnull;
010import javax.annotation.meta.TypeQualifierNickname;
011import javax.annotation.meta.When;
012
013/**
014 * A common annotation to declare that annotated elements can be {@code null}.
015 *
016 * <p>Leverages JSR-305 meta-annotations to indicate nullability in Java to common
017 * tools with JSR-305 support and used by Kotlin to infer nullability.
018 *
019 * <p>Should be used at parameter, return value, and field level. Methods override should
020 * repeat parent {@code @Nullable} annotations unless they behave differently.
021 *
022 * <p>Can be used in association with {@code @NonNullApi} to override the default
023 * non-nullable semantic to nullable.
024 */
025@Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
026@Retention(RetentionPolicy.CLASS)
027@Documented
028@Nonnull(when = When.MAYBE)
029@TypeQualifierNickname
030public @interface Nullable {
031}