Skip to content

Commit

Permalink
Add missing @NullableDecl to LogData.getTemplateContext() and .getL…
Browse files Browse the repository at this point in the history
…oggerName()

Fixes #381 .

Tested:
  % bazel test :api_tests
RELNOTES=Updates nullability for LogData
PiperOrigin-RevId: 634014539
  • Loading branch information
java-team-github-bot authored and Flogger Team committed May 16, 2024
1 parent aaaff6d commit 2141ffa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ public final LogSite getLogSite() {
}

@Override
@NullableDecl
public final TemplateContext getTemplateContext() {
return templateContext;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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();

/**
Expand Down Expand Up @@ -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();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -143,6 +144,7 @@ public boolean wasForced() {
}

@Override
@NullableDecl
public TemplateContext getTemplateContext() {
return context;
}
Expand Down

0 comments on commit 2141ffa

Please sign in to comment.