@@ -732,6 +732,83 @@ public @interface Priority {
732732}
733733----
734734
735+ === jakarta.annotation.Nonnull
736+
737+ The _Nonnull_ annotation is used to mark
738+ elements that cannot be `null`.
739+
740+ This information can be used for validation by IDEs, static analysis tools, and runtime.
741+
742+ The annotation may be present on any target.
743+ This specification defines behavior on following targets:
744+
745+ - Method - return type will never be `null`
746+ - Parameter - parameter must not be `null`
747+ - Field - field cannot be `null` after construction of the object is completed
748+
749+ [source,java]
750+ ----
751+ package jakarta.annotation;
752+
753+ import java.lang.annotation.Documented;
754+ import java.lang.annotation.Retention;
755+
756+ import static java.lang.annotation.RetentionPolicy.RUNTIME;
757+
758+ @Documented
759+ @Retention(RUNTIME)
760+ public @interface Nonnull {
761+ }
762+ ----
763+
764+ The following example shows the usage of the annotation defined above:
765+
766+ [source,java]
767+ ----
768+ public interface StockQuoteService {
769+ @Nonnull
770+ BigDecimal quote(@Nonnull String marker);
771+ }
772+ ----
773+
774+ === jakarta.annotation.Nullable
775+
776+ The _Nullable_ annotation is used to mark
777+ elements that may be `null`.
778+
779+ This information can be used for validation by IDEs, static analysis tools, and runtime.
780+
781+ The annotation may be present on any target.
782+ This specification defines behavior on following targets:
783+
784+ - Method - return type may be `null`
785+ - Parameter - parameter may be `null`
786+ - Field - field may be `null`
787+
788+ [source,java]
789+ ----
790+ package jakarta.annotation;
791+
792+ import java.lang.annotation.Documented;
793+ import java.lang.annotation.Retention;
794+
795+ import static java.lang.annotation.RetentionPolicy.RUNTIME;
796+
797+ @Documented
798+ @Retention(RUNTIME)
799+ public @interface Nullable {
800+ }
801+ ----
802+
803+ The following example shows the usage of the annotation defined above:
804+
805+ [source,java]
806+ ----
807+ public interface StockQuoteService {
808+ BigDecimal quote(String marker, @Nullable BigDecimal defaultValue);
809+ }
810+ ----
811+
735812=== jakarta.annotation.security.RunAs
736813
737814The _RunAs_ annotation defines the security
0 commit comments