From 13c94f8405a4499f6d9ce5fab9bef06c910d6f41 Mon Sep 17 00:00:00 2001 From: Flogger Team Date: Fri, 20 Oct 2023 20:17:06 -0700 Subject: [PATCH] Fix typos and add a nullability annotation. RELNOTES=n/a PiperOrigin-RevId: 575377954 --- .../main/java/com/google/common/flogger/MetadataKey.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/com/google/common/flogger/MetadataKey.java b/api/src/main/java/com/google/common/flogger/MetadataKey.java index 184f090..6c9c55c 100644 --- a/api/src/main/java/com/google/common/flogger/MetadataKey.java +++ b/api/src/main/java/com/google/common/flogger/MetadataKey.java @@ -22,6 +22,7 @@ import com.google.common.flogger.backend.Platform; import java.util.Iterator; +import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Key for logging semi-structured metadata values. @@ -42,7 +43,7 @@ * be re-parsed by logs related tools). * * - *

If you just want to log an general "key value pair" in a small number of log statements, it is + *

If you just want to log a general "key value pair" in a small number of log statements, it is * still better to just do something like {@code log("key=%s", value)}. * *

Metadata keys are expected to be singleton constants, and should never be allocated at the log @@ -57,7 +58,7 @@ * *

Custom subclasses of {@code MetadataKey} which override either of the protected {@link #emit} * methods should take care to avoid calling any code which might trigger logging since this could - * lead to unexpected recusrion, especially if the key is being logged as part of a {@code + * lead to unexpected recursion, especially if the key is being logged as part of a {@code * ScopedLoggingContext}. While there is protection against unbounded reentrant logging in Flogger, * it is still best practice to avoid it where possible. * @@ -94,7 +95,7 @@ public class MetadataKey { */ public interface KeyValueHandler { /** Handle a single key/value pair of contextual metadata for a log statement. */ - void handle(String key, Object value); + void handle(String key, @NullableDecl Object value); } /** @@ -225,7 +226,7 @@ public final void safeEmitRepeated(Iterator values, KeyValueHandler kvh) { *

  • Calling any code which could log using the same {@code MetadataKey} instance (unless you * implement protection against reentrant calling in this method). *
  • Calling code which might block (e.g. performing file I/O or acquiring locks). - *
  • Allocating non-trivial amounds of memory (e.g. recording values in an unbounded data + *
  • Allocating non-trivial amounts of memory (e.g. recording values in an unbounded data * structure). * *