From 4e4e56a2df730cdb6877449b6341279208f20a78 Mon Sep 17 00:00:00 2001 From: Ceki Gulcu Date: Sat, 6 Aug 2022 22:44:44 +0200 Subject: [PATCH] add CheckReturnValue annotation in org.slf4j.helpers Signed-off-by: Ceki Gulcu --- slf4j-api/pom.xml | 10 -------- .../org/slf4j/helpers/CheckReturnValue.java | 23 +++++++++++++++++++ .../org/slf4j/spi/LoggingEventBuilder.java | 2 +- 3 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 slf4j-api/src/main/java/org/slf4j/helpers/CheckReturnValue.java diff --git a/slf4j-api/pom.xml b/slf4j-api/pom.xml index c5a909bb1..1fadd9df8 100755 --- a/slf4j-api/pom.xml +++ b/slf4j-api/pom.xml @@ -22,16 +22,6 @@ org.slf4j - - - com.google.code.findbugs - jsr305 - 3.0.2 - true - - - - diff --git a/slf4j-api/src/main/java/org/slf4j/helpers/CheckReturnValue.java b/slf4j-api/src/main/java/org/slf4j/helpers/CheckReturnValue.java new file mode 100644 index 000000000..39ef64ceb --- /dev/null +++ b/slf4j-api/src/main/java/org/slf4j/helpers/CheckReturnValue.java @@ -0,0 +1,23 @@ +package org.slf4j.helpers; + + +import org.slf4j.Marker; + +import java.lang.annotation.*; + +/** + *

Used to annotate methods in the {@link org.slf4j.spi.LoggingEventBuilder} interface + * which return an instance of LoggingEventBuilder (usually as this). Such + * methods should be followed by one of the terminating log() methods returning + * void.

+ * + *

Some IDEs such as IntelliJ IDEA support this annotation at compile time.

+ * + * @author Ceki Gülcü + * @since 2.0.0-beta1 + */ +@Documented +@Target( { ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +public @interface CheckReturnValue { +} diff --git a/slf4j-api/src/main/java/org/slf4j/spi/LoggingEventBuilder.java b/slf4j-api/src/main/java/org/slf4j/spi/LoggingEventBuilder.java index bd921ac92..55e24cfb5 100755 --- a/slf4j-api/src/main/java/org/slf4j/spi/LoggingEventBuilder.java +++ b/slf4j-api/src/main/java/org/slf4j/spi/LoggingEventBuilder.java @@ -28,7 +28,7 @@ import org.slf4j.Marker; -import javax.annotation.CheckReturnValue; +import org.slf4j.helpers.CheckReturnValue; /** * This is the main interface in slf4j's fluent API for creating