Migrate from the deprecated `Charsets` constants (in Guava) to the `StandardCharsets` constants (in the JDK)

cl/658539667
This commit is contained in:
Kurt Alfred Kluever 2024-08-05 12:49:03 -07:00 committed by Eric Anderson
parent 9bed655c56
commit 06135a0745
25 changed files with 28 additions and 29 deletions

View File

@ -16,9 +16,9 @@
package io.grpc;
import static com.google.common.base.Charsets.US_ASCII;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.nio.charset.StandardCharsets.US_ASCII;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;

View File

@ -16,10 +16,10 @@
package io.grpc;
import static com.google.common.base.Charsets.US_ASCII;
import static com.google.common.base.Charsets.UTF_8;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.getStackTraceAsString;
import static java.nio.charset.StandardCharsets.US_ASCII;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
@ -34,7 +34,6 @@ import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
/**
* Defines the status of an operation by providing a standard {@link Code} in conjunction with an
* optional descriptive message. Instances of {@code Status} are created by starting with the

View File

@ -16,8 +16,8 @@
package io.grpc;
import static com.google.common.base.Charsets.US_ASCII;
import static com.google.common.base.Charsets.UTF_8;
import static java.nio.charset.StandardCharsets.US_ASCII;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

View File

@ -16,7 +16,7 @@
package io.grpc;
import static com.google.common.base.Charsets.UTF_8;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.io.ByteStreams;
import java.io.ByteArrayInputStream;

View File

@ -16,7 +16,7 @@
package io.grpc.auth;
import static com.google.common.base.Charsets.US_ASCII;
import static java.nio.charset.StandardCharsets.US_ASCII;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

View File

@ -16,7 +16,7 @@
package io.grpc.internal;
import static com.google.common.base.Charsets.UTF_8;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.base.Preconditions;
import io.grpc.Detachable;

View File

@ -16,7 +16,7 @@
package io.grpc.internal;
import static com.google.common.base.Charsets.US_ASCII;
import static java.nio.charset.StandardCharsets.US_ASCII;
import com.google.common.io.BaseEncoding;
import io.grpc.InternalMetadata;

View File

@ -16,7 +16,7 @@
package io.grpc.internal;
import static com.google.common.base.Charsets.UTF_8;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

View File

@ -16,9 +16,9 @@
package io.grpc.internal;
import static com.google.common.base.Charsets.US_ASCII;
import static io.grpc.internal.ClientStreamListener.RpcProgress.PROCESSED;
import static io.grpc.internal.GrpcUtil.DEFAULT_MAX_MESSAGE_SIZE;
import static java.nio.charset.StandardCharsets.US_ASCII;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;

View File

@ -16,8 +16,8 @@
package io.grpc.internal;
import static com.google.common.base.Charsets.UTF_8;
import static io.grpc.internal.ReadableBuffers.wrap;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

View File

@ -16,7 +16,7 @@
package io.grpc.internal;
import static com.google.common.base.Charsets.UTF_8;
import static java.nio.charset.StandardCharsets.UTF_8;
import java.nio.ByteBuffer;

View File

@ -16,7 +16,7 @@
package io.grpc.internal;
import static com.google.common.base.Charsets.UTF_8;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;

View File

@ -16,8 +16,8 @@
package io.grpc.internal;
import static com.google.common.base.Charsets.UTF_8;
import static io.grpc.internal.GrpcUtil.CONTENT_LENGTH_KEY;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;

View File

@ -16,10 +16,10 @@
package io.grpc.internal;
import static com.google.common.base.Charsets.US_ASCII;
import static com.google.common.base.Charsets.UTF_8;
import static io.grpc.Metadata.ASCII_STRING_MARSHALLER;
import static io.grpc.Metadata.BINARY_BYTE_MARSHALLER;
import static java.nio.charset.StandardCharsets.US_ASCII;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

View File

@ -16,8 +16,8 @@
package io.grpc.internal;
import static com.google.common.base.Charsets.UTF_8;
import static com.google.common.truth.Truth.assertThat;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;

View File

@ -16,7 +16,7 @@
package io.grpc.internal;
import static com.google.common.base.Charsets.UTF_8;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;

View File

@ -16,7 +16,7 @@
package io.grpc.testing.integration;
import static com.google.common.base.Charsets.UTF_8;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import com.google.common.io.CharStreams;

View File

@ -31,12 +31,12 @@
package io.grpc.netty;
import static com.google.common.base.Charsets.US_ASCII;
import static com.google.common.base.Preconditions.checkArgument;
import static io.grpc.netty.Utils.TE_HEADER;
import static io.netty.handler.codec.http2.Http2Error.PROTOCOL_ERROR;
import static io.netty.handler.codec.http2.Http2Exception.connectionError;
import static io.netty.util.AsciiString.isUpperCase;
import static java.nio.charset.StandardCharsets.US_ASCII;
import com.google.common.io.BaseEncoding;
import com.google.errorprone.annotations.CanIgnoreReturnValue;

View File

@ -16,9 +16,9 @@
package io.grpc.okhttp;
import static com.google.common.base.Charsets.UTF_8;
import static com.google.common.truth.Truth.assertThat;
import static io.grpc.okhttp.ExceptionHandlingFrameWriter.getLogLevel;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

View File

@ -16,7 +16,6 @@
package io.grpc.okhttp;
import static com.google.common.base.Charsets.UTF_8;
import static com.google.common.truth.Truth.assertThat;
import static io.grpc.internal.ClientStreamListener.RpcProgress.MISCARRIED;
import static io.grpc.internal.ClientStreamListener.RpcProgress.PROCESSED;
@ -25,6 +24,7 @@ import static io.grpc.okhttp.Headers.CONTENT_TYPE_HEADER;
import static io.grpc.okhttp.Headers.HTTP_SCHEME_HEADER;
import static io.grpc.okhttp.Headers.METHOD_HEADER;
import static io.grpc.okhttp.Headers.TE_HEADER;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;

View File

@ -16,7 +16,7 @@
package io.grpc.okhttp;
import static com.google.common.base.Charsets.UTF_8;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;

View File

@ -16,12 +16,12 @@
package io.grpc.okhttp;
import static com.google.common.base.Charsets.UTF_8;
import static com.google.common.truth.Truth.assertThat;
import static io.grpc.okhttp.Headers.CONTENT_TYPE_HEADER;
import static io.grpc.okhttp.Headers.HTTP_SCHEME_HEADER;
import static io.grpc.okhttp.Headers.METHOD_HEADER;
import static io.grpc.okhttp.Headers.TE_HEADER;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.mockito.AdditionalAnswers.answerVoid;
import static org.mockito.AdditionalAnswers.delegatesTo;
import static org.mockito.ArgumentMatchers.any;

View File

@ -16,8 +16,8 @@
package io.grpc.protobuf.services;
import static com.google.common.base.Charsets.UTF_8;
import static com.google.common.truth.Truth.assertThat;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

View File

@ -16,8 +16,8 @@
package io.grpc.internal.testing;
import static com.google.common.base.Charsets.UTF_8;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableMap;

View File

@ -16,8 +16,8 @@
package io.grpc.xds.internal.rbac.engine;
import static com.google.common.base.Charsets.US_ASCII;
import static com.google.common.truth.Truth.assertThat;
import static java.nio.charset.StandardCharsets.US_ASCII;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;