diff --git a/api/src/main/java/com/google/common/flogger/LogContext.java b/api/src/main/java/com/google/common/flogger/LogContext.java index 606afc2..76b0133 100644 --- a/api/src/main/java/com/google/common/flogger/LogContext.java +++ b/api/src/main/java/com/google/common/flogger/LogContext.java @@ -426,6 +426,7 @@ public final LogSite getLogSite() { } @Override + @NullableDecl public final TemplateContext getTemplateContext() { return templateContext; } diff --git a/api/src/main/java/com/google/common/flogger/backend/LogData.java b/api/src/main/java/com/google/common/flogger/backend/LogData.java index 1fcaf2e..adc6dbe 100644 --- a/api/src/main/java/com/google/common/flogger/backend/LogData.java +++ b/api/src/main/java/com/google/common/flogger/backend/LogData.java @@ -18,6 +18,7 @@ import com.google.common.flogger.LogSite; import java.util.logging.Level; +import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * A backend API for determining metadata associated with a log statement. @@ -46,6 +47,7 @@ public interface LogData { * Returns the logger name (which is usually a canonicalized class name) or {@code null} if not * given. */ + @NullableDecl String getLoggerName(); /** @@ -95,9 +97,10 @@ public interface LogData { /** * Returns a template key for this log statement, or {@code null} if the statement does not - * require formatting (in which case the message to be logged can be determined by calling - * {@link #getLiteralArgument()}). + * require formatting (in which case the message to be logged can be determined by calling* {@link + * #getLiteralArgument()}). */ + @NullableDecl TemplateContext getTemplateContext(); /** diff --git a/api/src/test/java/com/google/common/flogger/testing/FakeLogData.java b/api/src/test/java/com/google/common/flogger/testing/FakeLogData.java index d319746..9cca979 100644 --- a/api/src/test/java/com/google/common/flogger/testing/FakeLogData.java +++ b/api/src/test/java/com/google/common/flogger/testing/FakeLogData.java @@ -30,6 +30,7 @@ import com.google.common.flogger.parser.MessageParser; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.logging.Level; +import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * A mutable fake {@link LogData} implementation to help test logging backends and other log @@ -143,6 +144,7 @@ public boolean wasForced() { } @Override + @NullableDecl public TemplateContext getTemplateContext() { return context; }