From f601bbb2ac8622e27e4b78c5f713e1f36328b289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Tue, 17 Jun 2025 16:41:36 +0200 Subject: [PATCH] Allow usage of `@CheckReturnValue` on types and ctors Closes gh-34910 --- .../main/java/org/springframework/lang/CheckReturnValue.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spring-core/src/main/java/org/springframework/lang/CheckReturnValue.java b/spring-core/src/main/java/org/springframework/lang/CheckReturnValue.java index 57a400c7f11..1d8ff9fcfbb 100644 --- a/spring-core/src/main/java/org/springframework/lang/CheckReturnValue.java +++ b/spring-core/src/main/java/org/springframework/lang/CheckReturnValue.java @@ -33,10 +33,13 @@ import java.lang.annotation.Target; * and the return value is only interesting when adding an element to a set, * to see if the set already contained that element before. * + *

When used on a type, the annotation applies to all constructors and all + * methods that do not return {@code void}. + * * @author Sebastien Deleuze * @since 6.2 */ @Documented -@Target(ElementType.METHOD) +@Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR}) public @interface CheckReturnValue { }