Skip to content

Commit 61545fa

Browse files
committed
Deprecate Spring nullability annotations
JSpecify annotations should be used instead. See gh-28797
1 parent 0e85d95 commit 61545fa

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

spring-core/src/main/java/org/springframework/lang/NonNull.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,6 +42,7 @@
4242
* @author Sebastien Deleuze
4343
* @author Juergen Hoeller
4444
* @since 5.0
45+
* @deprecated since 7.0; use {@link org.jspecify.annotations.NonNull} instead
4546
* @see NonNullApi
4647
* @see NonNullFields
4748
* @see Nullable
@@ -51,5 +52,6 @@
5152
@Documented
5253
@Nonnull
5354
@TypeQualifierNickname
55+
@Deprecated
5456
public @interface NonNull {
5557
}

spring-core/src/main/java/org/springframework/lang/NonNullApi.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -38,6 +38,7 @@
3838
* @author Sebastien Deleuze
3939
* @author Juergen Hoeller
4040
* @since 5.0
41+
* @deprecated since 7.0; use {@link org.jspecify.annotations.NullMarked} instead
4142
* @see NonNullFields
4243
* @see Nullable
4344
* @see NonNull
@@ -47,5 +48,6 @@
4748
@Documented
4849
@Nonnull
4950
@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER})
51+
@Deprecated
5052
public @interface NonNullApi {
5153
}

spring-core/src/main/java/org/springframework/lang/NonNullFields.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@
3737
*
3838
* @author Sebastien Deleuze
3939
* @since 5.0
40+
* @deprecated since 7.0; use {@link org.jspecify.annotations.NullMarked} instead
4041
* @see NonNullApi
4142
* @see Nullable
4243
* @see NonNull
@@ -46,5 +47,6 @@
4647
@Documented
4748
@Nonnull
4849
@TypeQualifierDefault(ElementType.FIELD)
50+
@Deprecated
4951
public @interface NonNullFields {
5052
}

spring-core/src/main/java/org/springframework/lang/Nullable.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
* @author Sebastien Deleuze
4343
* @author Juergen Hoeller
4444
* @since 5.0
45+
* @deprecated since 7.0; use {@link org.jspecify.annotations.Nullable} instead
4546
* @see NonNullApi
4647
* @see NonNullFields
4748
* @see NonNull
@@ -51,5 +52,6 @@
5152
@Documented
5253
@CheckForNull
5354
@TypeQualifierNickname
55+
@Deprecated
5456
public @interface Nullable {
5557
}

0 commit comments

Comments
 (0)