Deprecate trace-propagators StringUtils to make package private. (#2481)

* Make trace-propagators StringUtils package private.

* Deprecate
This commit is contained in:
Anuraag Agrawal 2021-01-13 02:16:44 +09:00 committed by GitHub
parent 1fc179e546
commit 096456c577
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 19 additions and 0 deletions

View File

@ -14,6 +14,7 @@ import java.util.logging.Logger;
import javax.annotation.concurrent.Immutable;
@Immutable
@SuppressWarnings("deprecation") // Remove after StringUtils is made package-private
final class B3PropagatorExtractorMultipleHeaders implements B3PropagatorExtractor {
private static final Logger logger =
Logger.getLogger(B3PropagatorExtractorMultipleHeaders.class.getName());

View File

@ -14,6 +14,7 @@ import java.util.logging.Logger;
import javax.annotation.concurrent.Immutable;
@Immutable
@SuppressWarnings("deprecation") // Remove after StringUtils is made package-private
final class B3PropagatorExtractorSingleHeader implements B3PropagatorExtractor {
private static final Logger logger =
Logger.getLogger(B3PropagatorExtractorSingleHeader.class.getName());

View File

@ -19,6 +19,7 @@ import javax.annotation.concurrent.Immutable;
* B3Propagator.
*/
@Immutable
@SuppressWarnings("deprecation") // Remove after StringUtils is made package-private
final class Common {
private static final Logger logger = Logger.getLogger(Common.class.getName());

View File

@ -31,6 +31,7 @@ import javax.annotation.concurrent.Immutable;
* Format</a>.
*/
@Immutable
@SuppressWarnings("deprecation") // Remove after StringUtils is made package-private
public final class JaegerPropagator implements TextMapPropagator {
private static final Logger logger = Logger.getLogger(JaegerPropagator.class.getName());

View File

@ -26,6 +26,7 @@ import javax.annotation.concurrent.Immutable;
* TextMapPropagator</a>.
*/
@Immutable
@SuppressWarnings("deprecation") // Remove after StringUtils is made package-private
public final class OtTracerPropagator implements TextMapPropagator {
static final String TRACE_ID_HEADER = "ot-tracer-traceid";

View File

@ -14,7 +14,13 @@ package io.opentelemetry.extension.trace.propagation;
import java.util.Objects;
import javax.annotation.concurrent.Immutable;
/**
* Utilities for working with strings.
*
* @deprecated Will be removed without a replacement
*/
@Immutable
@Deprecated
public final class StringUtils {
/**
@ -37,7 +43,9 @@ public final class StringUtils {
* @param padChar the character to insert at the beginning of the result until the minimum length
* is reached
* @return the padded string
* @deprecated Will be removed without a replacement
*/
@Deprecated
public static String padStart(String string, int minLength, char padChar) {
Objects.requireNonNull(string);
if (string.length() >= minLength) {
@ -59,7 +67,9 @@ public final class StringUtils {
*
* @param string a string reference to check
* @return {@code true} if the string is null or is the empty string
* @deprecated Will be removed without a replacement
*/
@Deprecated
public static boolean isNullOrEmpty(String string) {
return string == null || string.isEmpty();
}
@ -71,7 +81,9 @@ public final class StringUtils {
* @param minLength the minimum length the resulting padded string must have. Can be zero or
* negative, in which case the input string is always returned.
* @return the padded string
* @deprecated Will be removed without a replacement
*/
@Deprecated
public static String padLeft(String value, int minLength) {
return padStart(value, minLength, '0');
}

View File

@ -26,6 +26,7 @@ import javax.annotation.Nullable;
import org.junit.jupiter.api.Test;
/** Unit tests for {@link B3Propagator}. */
@SuppressWarnings("deprecation") // Remove after StringUtils is made package-private
class B3PropagatorTest {
private static final TraceState TRACE_STATE_DEFAULT = TraceState.builder().build();

View File

@ -10,6 +10,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
import org.junit.jupiter.api.Test;
@SuppressWarnings("deprecation") // Remove after StringUtils is made package-private
class StringUtilsTest {
@Test