Skip to content

Commit

Permalink
annotates new methods to help static analysis tools
Browse files Browse the repository at this point in the history
Signed-off-by: Kengo TODA <[email protected]>
  • Loading branch information
KengoTODA authored and ceki committed Sep 28, 2022
1 parent b2cb05f commit 143978c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions slf4j-api/src/main/java/org/slf4j/Logger.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import static org.slf4j.event.Level.WARN;

import org.slf4j.event.Level;
import org.slf4j.helpers.CheckReturnValue;
import org.slf4j.spi.DefaultLoggingEventBuilder;
import org.slf4j.spi.LoggingEventBuilder;
import org.slf4j.spi.NOPLoggingEventBuilder;
Expand Down Expand Up @@ -107,6 +108,7 @@ public interface Logger {
* @return a new {@link LoggingEventBuilder} instance as appropriate for this logger
* @since 2.0
*/
@CheckReturnValue
default public LoggingEventBuilder makeLoggingEventBuilder(Level level) {
return new DefaultLoggingEventBuilder(this, level);
}
Expand All @@ -121,6 +123,7 @@ default public LoggingEventBuilder makeLoggingEventBuilder(Level level) {
* @return a new {@link LoggingEventBuilder} instance as appropriate for this logger
* @since 2.0
*/
@CheckReturnValue
default public LoggingEventBuilder atLevel(Level level) {
if (isEnabledForLevel(level)) {
return makeLoggingEventBuilder(level);
Expand Down Expand Up @@ -243,6 +246,7 @@ default public boolean isEnabledForLevel(Level level) {
* @return LoggingEventBuilder instance as appropriate for level TRACE
* @since 2.0
*/
@CheckReturnValue
default public LoggingEventBuilder atTrace() {
if (isTraceEnabled()) {
return makeLoggingEventBuilder(TRACE);
Expand Down Expand Up @@ -439,6 +443,7 @@ default public LoggingEventBuilder atTrace() {
* @return LoggingEventBuilder instance as appropriate for level DEBUG
* @since 2.0
*/
@CheckReturnValue
default public LoggingEventBuilder atDebug() {
if (isDebugEnabled()) {
return makeLoggingEventBuilder(DEBUG);
Expand Down Expand Up @@ -579,6 +584,7 @@ default public LoggingEventBuilder atDebug() {
* @return LoggingEventBuilder instance as appropriate for level INFO
* @since 2.0
*/
@CheckReturnValue
default public LoggingEventBuilder atInfo() {
if (isInfoEnabled()) {
return makeLoggingEventBuilder(INFO);
Expand Down Expand Up @@ -719,6 +725,7 @@ default public LoggingEventBuilder atInfo() {
* @return LoggingEventBuilder instance as appropriate for level WARN
* @since 2.0
*/
@CheckReturnValue
default public LoggingEventBuilder atWarn() {
if (isWarnEnabled()) {
return makeLoggingEventBuilder(WARN);
Expand Down Expand Up @@ -860,6 +867,7 @@ default public LoggingEventBuilder atWarn() {
* @return LoggingEventBuilder instance as appropriate for level ERROR
* @since 2.0
*/
@CheckReturnValue
default public LoggingEventBuilder atError() {
if (isErrorEnabled()) {
return makeLoggingEventBuilder(ERROR);
Expand Down

0 comments on commit 143978c

Please sign in to comment.