Skip to content

Commit 8ef74df

Browse files
committed
Prevent compilation warnings with @Nullable
This commit replaces `@Nonnull(when = When.MAYBE)` meta-annotation in org.springframework.lang.Nullable by `@CheckForNull` in order to prevent "unknown enum constant When.MAYBE" compilation warnings. IntelliJ IDEA 2024.1.2+ is required to interpret correctly the related annotations. Closes gh-27183
1 parent 0a0f4c7 commit 8ef74df

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

+3-4
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.
@@ -22,9 +22,8 @@
2222
import java.lang.annotation.RetentionPolicy;
2323
import java.lang.annotation.Target;
2424

25-
import javax.annotation.Nonnull;
25+
import javax.annotation.CheckForNull;
2626
import javax.annotation.meta.TypeQualifierNickname;
27-
import javax.annotation.meta.When;
2827

2928
/**
3029
* A common Spring annotation to declare that annotated elements can be {@code null}
@@ -50,7 +49,7 @@
5049
@Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
5150
@Retention(RetentionPolicy.RUNTIME)
5251
@Documented
53-
@Nonnull(when = When.MAYBE)
52+
@CheckForNull
5453
@TypeQualifierNickname
5554
public @interface Nullable {
5655
}

0 commit comments

Comments
 (0)