Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update errorProneVersion to v2.23.0 #5927

Merged
merged 2 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ public final class GlobalOpenTelemetry {

private static final Object mutex = new Object();

@Nullable private static volatile ObfuscatedOpenTelemetry globalOpenTelemetry;
@SuppressWarnings("NonFinalStaticField")
@Nullable
private static volatile ObfuscatedOpenTelemetry globalOpenTelemetry;

@SuppressWarnings("NonFinalStaticField")
@GuardedBy("mutex")
@Nullable
private static Throwable setGlobalCaller;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ public final class GlobalEventEmitterProvider {
private static final AtomicReference<EventEmitterProvider> instance =
new AtomicReference<>(EventEmitterProvider.noop());

@Nullable private static volatile Throwable setInstanceCaller;
@SuppressWarnings("NonFinalStaticField")
@Nullable
private static volatile Throwable setInstanceCaller;

private GlobalEventEmitterProvider() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class BraveInOtelTest {
private static final TraceContext TRACE_CONTEXT =
TraceContext.newBuilder().traceId(1).spanId(1).addExtra("japan").build();

@SuppressWarnings("NonFinalStaticField")
private static ExecutorService otherThread;

@BeforeAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class GrpcInOtelTest {
private static final io.grpc.Context.Key<String> FOOD = io.grpc.Context.key("food");
private static final io.grpc.Context.Key<String> COUNTRY = io.grpc.Context.key("country");

@SuppressWarnings("NonFinalStaticField")
private static ExecutorService otherThread;

@BeforeAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ final class ContextStorageWrappers {

private static final Logger log = Logger.getLogger(ContextStorageWrappers.class.getName());

@SuppressWarnings("NonFinalStaticField")
private static boolean storageInitialized;

private static final List<Function<? super ContextStorage, ? extends ContextStorage>> wrappers =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class OtelAsBraveTest {
private static final TraceContext TRACE_CONTEXT =
TraceContext.newBuilder().traceId(1).spanId(1).addExtra("japan").build();

@SuppressWarnings("NonFinalStaticField")
private static ExecutorService otherThread;

@BeforeAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class OtelInBraveTest {
BraveContextStorageProvider.toBraveContext(
TraceContext.newBuilder().traceId(1).spanId(1).build(), CONTEXT_WITH_ANIMAL);

@SuppressWarnings("NonFinalStaticField")
private static ExecutorService otherThread;

@BeforeAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class OtelInGrpcTest {
private static final io.grpc.Context.Key<String> FOOD = io.grpc.Context.key("food");
private static final io.grpc.Context.Key<String> COUNTRY = io.grpc.Context.key("country");

@SuppressWarnings("NonFinalStaticField")
private static ExecutorService otherThread;

@BeforeAll
Expand Down
2 changes: 1 addition & 1 deletion dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ val DEPENDENCY_BOMS = listOf(
)

val autoValueVersion = "1.10.4"
val errorProneVersion = "2.22.0"
val errorProneVersion = "2.23.0"
val jmhVersion = "1.37"
// Mockito 5.x.x requires Java 11 https://github.com/mockito/mockito/releases/tag/v5.0.0
val mockitoVersion = "4.11.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class JaegerThriftIntegrationTest {
private static final String JAEGER_URL = "http://localhost";

@Container
public static GenericContainer<?> jaegerContainer =
public static final GenericContainer<?> jaegerContainer =
new GenericContainer<>("ghcr.io/open-telemetry/opentelemetry-java/jaeger:1.32")
.withImagePullPolicy(PullPolicy.alwaysPull())
.withExposedPorts(THRIFT_HTTP_PORT, THRIFT_UDP_PORT, QUERY_PORT, HEALTH_PORT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509KeyManager;
import javax.net.ssl.X509TrustManager;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

Expand Down Expand Up @@ -99,24 +98,20 @@ protected CompletionStage<byte[]> handleMessage(
@RegisterExtension
static final SelfSignedCertificateExtension clientTls = new SelfSignedCertificateExtension();

private static JaegerGrpcSpanExporter exporter;
private JaegerGrpcSpanExporter exporter;

@BeforeAll
static void setUp() {
@BeforeEach
void setUp() {
exporter =
JaegerGrpcSpanExporter.builder()
.setEndpoint(server.httpUri().toString())
.setMeterProvider(MeterProvider.noop())
.build();
}

@AfterAll
static void tearDown() {
exporter.shutdown();
}

@AfterEach
void reset() {
void tearDown() {
exporter.shutdown();
postedRequests.clear();
}

Expand Down Expand Up @@ -213,7 +208,7 @@ void testExportMultipleResources() throws Exception {
}
}

private static void verifyBatch(Model.Batch batch) throws Exception {
private void verifyBatch(Model.Batch batch) throws Exception {
assertThat(batch.getSpansCount()).isEqualTo(1);
assertThat(TraceId.fromBytes(batch.getSpans(0).getTraceId().toByteArray())).isNotNull();
assertThat(batch.getProcess().getTagsCount()).isEqualTo(5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class JaegerIntegrationTest {
private static final String JAEGER_URL = "http://localhost";

@Container
public static GenericContainer<?> jaegerContainer =
public static final GenericContainer<?> jaegerContainer =
new GenericContainer<>("ghcr.io/open-telemetry/opentelemetry-java/jaeger:1.32")
.withImagePullPolicy(PullPolicy.alwaysPull())
.withExposedPorts(COLLECTOR_PORT, QUERY_PORT, HEALTH_PORT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
@Measurement(iterations = 20, time = 1)
@Fork(1)
@State(Scope.Benchmark)
@SuppressWarnings("NonFinalStaticField")
public class OltpExporterBenchmark {
private static final Server server =
Server.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

Expand Down Expand Up @@ -70,11 +70,11 @@ protected CompletionStage<byte[]> handleMessage(
}
};

private static SdkTracerProvider tracerProvider;
private static Tracer tracer;
private SdkTracerProvider tracerProvider;
private Tracer tracer;

@BeforeAll
public static void setUp() {
@BeforeEach
public void setUp() {
tracerProvider =
SdkTracerProvider.builder()
.setResource(RESOURCE)
Expand All @@ -89,12 +89,12 @@ public static void setUp() {
tracer = tracerProvider.get("benchmark");
}

@AfterAll
public static void tearDown() {
@AfterEach
public void tearDown() {
tracerProvider.close();
}

private static void createSpan() {
private void createSpan() {
Span span = tracer.spanBuilder("POST /search").startSpan();
try (Scope ignored = span.makeCurrent()) {
span.setAllAttributes(SPAN_ATTRIBUTES);
Expand All @@ -109,10 +109,10 @@ void runPipeline() {
long endTimeNanos = startTimeNanos + TimeUnit.SECONDS.toNanos(60);
try {
while (System.nanoTime() < endTimeNanos) {
SpanPipelineOtlpBenchmark.createSpan();
createSpan();
}
} finally {
SpanPipelineOtlpBenchmark.tearDown();
tearDown();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
* running in process, allowing assertions to be made against the data.
*/
@Testcontainers(disabledWithoutDocker = true)
@SuppressWarnings("NonFinalStaticField")
class CollectorIntegrationTest {

private static final String COLLECTOR_IMAGE =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@
class PrometheusHttpServerTest {
private static final AtomicReference<List<MetricData>> metricData = new AtomicReference<>();

@SuppressWarnings("NonFinalStaticField")
static PrometheusHttpServer prometheusServer;

@SuppressWarnings("NonFinalStaticField")
static WebClient client;

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
@Testcontainers(disabledWithoutDocker = true)
class PrometheusIntegrationTest {

@SuppressWarnings("NonFinalStaticField")
private static SdkMeterProvider meterProvider;

@SuppressWarnings("NonFinalStaticField")
private static GenericContainer<?> prometheus;

@BeforeAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ZipkinSpanExporterEndToEndHttpTest {
SEEN_ATTRIBUTES.toBuilder().put(AttributeKey.booleanKey("success"), false).build();

@Container
public static GenericContainer<?> zipkinContainer =
public static final GenericContainer<?> zipkinContainer =
new GenericContainer<>("ghcr.io/openzipkin/zipkin:2.23")
.withExposedPorts(ZIPKIN_API_PORT)
.waitingFor(Wait.forHttp("/health").forPort(ZIPKIN_API_PORT));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ abstract class OtlpExporterIntegrationTest {
@RegisterExtension
static final SelfSignedCertificateExtension clientTls = new SelfSignedCertificateExtension();

@SuppressWarnings("NonFinalStaticField")
private static OtlpGrpcServer grpcServer;

@SuppressWarnings("NonFinalStaticField")
private static GenericContainer<?> collector;

@BeforeAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ class B3PropagationIntegrationTest {

private static final InMemorySpanExporter spanExporter = InMemorySpanExporter.create();

@SuppressWarnings("NonFinalStaticField")
static WebClient b3MultiClient;

@SuppressWarnings("NonFinalStaticField")
static WebClient b3SingleClient;

private static class FrontendService implements HttpService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class TracerShimTest {
static final io.opentelemetry.api.baggage.Baggage EMPTY_BAGGAGE =
io.opentelemetry.api.baggage.Baggage.empty();

@RegisterExtension static OpenTelemetryExtension otelTesting = OpenTelemetryExtension.create();
@RegisterExtension
static final OpenTelemetryExtension otelTesting = OpenTelemetryExtension.create();

TracerShim tracerShim;
TracerProvider provider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ public class OtlpPipelineStressTest {
public static final int OTLP_RECEIVER_PORT = 4317;
public static final int COLLECTOR_PROXY_PORT = 44444;
public static final int TOXIPROXY_CONTROL_PORT = 8474;
public static Network network = Network.newNetwork();
public static AtomicLong totalSpansReceivedByCollector = new AtomicLong();
public static final Network network = Network.newNetwork();
public static final AtomicLong totalSpansReceivedByCollector = new AtomicLong();

private static final Logger logger = LoggerFactory.getLogger(OtlpPipelineStressTest.class);

@Container
public static GenericContainer<?> collectorContainer =
public static final GenericContainer<?> collectorContainer =
new GenericContainer<>(
DockerImageName.parse("ghcr.io/open-telemetry/opentelemetry-java/otel-collector"))
.withImagePullPolicy(PullPolicy.alwaysPull())
Expand All @@ -93,7 +93,7 @@ public class OtlpPipelineStressTest {
.waitingFor(new LogMessageWaitStrategy().withRegEx(".*Everything is ready.*"));

@Container
public static GenericContainer<?> toxiproxyContainer =
public static final GenericContainer<?> toxiproxyContainer =
new GenericContainer<>(
DockerImageName.parse("ghcr.io/open-telemetry/opentelemetry-java/toxiproxy"))
.withImagePullPolicy(PullPolicy.alwaysPull())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class JaegerRemoteSamplerIntegrationTest {
private static final String SERVICE_NAME_DEFAULT_STRATEGY = "foobar";

@Container
public static GenericContainer<?> jaegerContainer =
public static final GenericContainer<?> jaegerContainer =
new GenericContainer<>("ghcr.io/open-telemetry/opentelemetry-java/jaeger:1.32")
.withImagePullPolicy(PullPolicy.alwaysPull())
.withCommand("--sampling.strategies-file=/sampling.json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
public final class DebugConfig {
private static final String ENABLE_METRICS_DEBUG_PROPERTY = "otel.experimental.sdk.metrics.debug";

@SuppressWarnings("NonFinalStaticField")
private static boolean enabled;

private DebugConfig() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public static ContextStorage getContextStorage() {
private enum SettableContextStorage implements ContextStorage {
INSTANCE;

@SuppressWarnings("NonFinalStaticField")
private static volatile ContextStorage delegate = createStorage();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

@State(Scope.Benchmark)
public class ExceptionBenchmark {
@SuppressWarnings("NonFinalStaticField")
private static SpanBuilder spanBuilder;

@Setup(Level.Trial)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@

@State(Scope.Benchmark)
public class SpanBenchmark {
@SuppressWarnings("NonFinalStaticField")
private static SdkSpanBuilder sdkSpanBuilder;

private final Resource serviceResource =
Resource.create(
Attributes.builder()
Expand Down