Skip to content

Commit cb44b2b

Browse files
Update errorProneVersion to v2.23.0 (#5927)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jack Berg <[email protected]>
1 parent c3a2e94 commit cb44b2b

File tree

27 files changed

+62
-35
lines changed

27 files changed

+62
-35
lines changed

api/all/src/main/java/io/opentelemetry/api/GlobalOpenTelemetry.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ public final class GlobalOpenTelemetry {
5353

5454
private static final Object mutex = new Object();
5555

56-
@Nullable private static volatile ObfuscatedOpenTelemetry globalOpenTelemetry;
56+
@SuppressWarnings("NonFinalStaticField")
57+
@Nullable
58+
private static volatile ObfuscatedOpenTelemetry globalOpenTelemetry;
5759

60+
@SuppressWarnings("NonFinalStaticField")
5861
@GuardedBy("mutex")
5962
@Nullable
6063
private static Throwable setGlobalCaller;

api/events/src/main/java/io/opentelemetry/api/events/GlobalEventEmitterProvider.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ public final class GlobalEventEmitterProvider {
2020
private static final AtomicReference<EventEmitterProvider> instance =
2121
new AtomicReference<>(EventEmitterProvider.noop());
2222

23-
@Nullable private static volatile Throwable setInstanceCaller;
23+
@SuppressWarnings("NonFinalStaticField")
24+
@Nullable
25+
private static volatile Throwable setInstanceCaller;
2426

2527
private GlobalEventEmitterProvider() {}
2628

context/src/braveInOtelTest/java/io/opentelemetry/context/BraveInOtelTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class BraveInOtelTest {
2727
private static final TraceContext TRACE_CONTEXT =
2828
TraceContext.newBuilder().traceId(1).spanId(1).addExtra("japan").build();
2929

30+
@SuppressWarnings("NonFinalStaticField")
3031
private static ExecutorService otherThread;
3132

3233
@BeforeAll

context/src/grpcInOtelTest/java/io/opentelemetry/context/GrpcInOtelTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class GrpcInOtelTest {
2121
private static final io.grpc.Context.Key<String> FOOD = io.grpc.Context.key("food");
2222
private static final io.grpc.Context.Key<String> COUNTRY = io.grpc.Context.key("country");
2323

24+
@SuppressWarnings("NonFinalStaticField")
2425
private static ExecutorService otherThread;
2526

2627
@BeforeAll

context/src/main/java/io/opentelemetry/context/ContextStorageWrappers.java

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ final class ContextStorageWrappers {
1919

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

22+
@SuppressWarnings("NonFinalStaticField")
2223
private static boolean storageInitialized;
2324

2425
private static final List<Function<? super ContextStorage, ? extends ContextStorage>> wrappers =

context/src/otelAsBraveTest/java/io/opentelemetry/context/OtelAsBraveTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class OtelAsBraveTest {
2727
private static final TraceContext TRACE_CONTEXT =
2828
TraceContext.newBuilder().traceId(1).spanId(1).addExtra("japan").build();
2929

30+
@SuppressWarnings("NonFinalStaticField")
3031
private static ExecutorService otherThread;
3132

3233
@BeforeAll

context/src/otelInBraveTest/java/io/opentelemetry/context/OtelInBraveTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class OtelInBraveTest {
2828
BraveContextStorageProvider.toBraveContext(
2929
TraceContext.newBuilder().traceId(1).spanId(1).build(), CONTEXT_WITH_ANIMAL);
3030

31+
@SuppressWarnings("NonFinalStaticField")
3132
private static ExecutorService otherThread;
3233

3334
@BeforeAll

context/src/otelInGrpcTest/java/io/opentelemetry/context/OtelInGrpcTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class OtelInGrpcTest {
2121
private static final io.grpc.Context.Key<String> FOOD = io.grpc.Context.key("food");
2222
private static final io.grpc.Context.Key<String> COUNTRY = io.grpc.Context.key("country");
2323

24+
@SuppressWarnings("NonFinalStaticField")
2425
private static ExecutorService otherThread;
2526

2627
@BeforeAll

dependencyManagement/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ val DEPENDENCY_BOMS = listOf(
2525
)
2626

2727
val autoValueVersion = "1.10.4"
28-
val errorProneVersion = "2.22.0"
28+
val errorProneVersion = "2.23.0"
2929
val jmhVersion = "1.37"
3030
// Mockito 5.x.x requires Java 11 https://github.com/mockito/mockito/releases/tag/v5.0.0
3131
val mockitoVersion = "4.11.0"

exporters/jaeger-thrift/src/test/java/io/opentelemetry/exporter/jaeger/thrift/JaegerThriftIntegrationTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class JaegerThriftIntegrationTest {
4747
private static final String JAEGER_URL = "http://localhost";
4848

4949
@Container
50-
public static GenericContainer<?> jaegerContainer =
50+
public static final GenericContainer<?> jaegerContainer =
5151
new GenericContainer<>("ghcr.io/open-telemetry/opentelemetry-java/jaeger:1.32")
5252
.withImagePullPolicy(PullPolicy.alwaysPull())
5353
.withExposedPorts(THRIFT_HTTP_PORT, THRIFT_UDP_PORT, QUERY_PORT, HEALTH_PORT)

exporters/jaeger/src/test/java/io/opentelemetry/exporter/jaeger/JaegerGrpcSpanExporterTest.java

+7-12
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@
5555
import javax.net.ssl.TrustManager;
5656
import javax.net.ssl.X509KeyManager;
5757
import javax.net.ssl.X509TrustManager;
58-
import org.junit.jupiter.api.AfterAll;
5958
import org.junit.jupiter.api.AfterEach;
60-
import org.junit.jupiter.api.BeforeAll;
59+
import org.junit.jupiter.api.BeforeEach;
6160
import org.junit.jupiter.api.Test;
6261
import org.junit.jupiter.api.extension.RegisterExtension;
6362

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

102-
private static JaegerGrpcSpanExporter exporter;
101+
private JaegerGrpcSpanExporter exporter;
103102

104-
@BeforeAll
105-
static void setUp() {
103+
@BeforeEach
104+
void setUp() {
106105
exporter =
107106
JaegerGrpcSpanExporter.builder()
108107
.setEndpoint(server.httpUri().toString())
109108
.setMeterProvider(MeterProvider.noop())
110109
.build();
111110
}
112111

113-
@AfterAll
114-
static void tearDown() {
115-
exporter.shutdown();
116-
}
117-
118112
@AfterEach
119-
void reset() {
113+
void tearDown() {
114+
exporter.shutdown();
120115
postedRequests.clear();
121116
}
122117

@@ -213,7 +208,7 @@ void testExportMultipleResources() throws Exception {
213208
}
214209
}
215210

216-
private static void verifyBatch(Model.Batch batch) throws Exception {
211+
private void verifyBatch(Model.Batch batch) throws Exception {
217212
assertThat(batch.getSpansCount()).isEqualTo(1);
218213
assertThat(TraceId.fromBytes(batch.getSpans(0).getTraceId().toByteArray())).isNotNull();
219214
assertThat(batch.getProcess().getTagsCount()).isEqualTo(5);

exporters/jaeger/src/test/java/io/opentelemetry/exporter/jaeger/JaegerIntegrationTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class JaegerIntegrationTest {
4141
private static final String JAEGER_URL = "http://localhost";
4242

4343
@Container
44-
public static GenericContainer<?> jaegerContainer =
44+
public static final GenericContainer<?> jaegerContainer =
4545
new GenericContainer<>("ghcr.io/open-telemetry/opentelemetry-java/jaeger:1.32")
4646
.withImagePullPolicy(PullPolicy.alwaysPull())
4747
.withExposedPorts(COLLECTOR_PORT, QUERY_PORT, HEALTH_PORT)

exporters/otlp/all/src/jmh/java/io/opentelemetry/exporter/otlp/trace/OltpExporterBenchmark.java

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
@Measurement(iterations = 20, time = 1)
4545
@Fork(1)
4646
@State(Scope.Benchmark)
47+
@SuppressWarnings("NonFinalStaticField")
4748
public class OltpExporterBenchmark {
4849
private static final Server server =
4950
Server.builder()

exporters/otlp/all/src/testSpanPipeline/java/io/opentelemetry/exporter/otlp/trace/SpanPipelineOtlpBenchmark.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
import java.util.concurrent.CompletableFuture;
2424
import java.util.concurrent.CompletionStage;
2525
import java.util.concurrent.TimeUnit;
26-
import org.junit.jupiter.api.AfterAll;
27-
import org.junit.jupiter.api.BeforeAll;
26+
import org.junit.jupiter.api.AfterEach;
27+
import org.junit.jupiter.api.BeforeEach;
2828
import org.junit.jupiter.api.Test;
2929
import org.junit.jupiter.api.extension.RegisterExtension;
3030

@@ -70,11 +70,11 @@ protected CompletionStage<byte[]> handleMessage(
7070
}
7171
};
7272

73-
private static SdkTracerProvider tracerProvider;
74-
private static Tracer tracer;
73+
private SdkTracerProvider tracerProvider;
74+
private Tracer tracer;
7575

76-
@BeforeAll
77-
public static void setUp() {
76+
@BeforeEach
77+
public void setUp() {
7878
tracerProvider =
7979
SdkTracerProvider.builder()
8080
.setResource(RESOURCE)
@@ -89,12 +89,12 @@ public static void setUp() {
8989
tracer = tracerProvider.get("benchmark");
9090
}
9191

92-
@AfterAll
93-
public static void tearDown() {
92+
@AfterEach
93+
public void tearDown() {
9494
tracerProvider.close();
9595
}
9696

97-
private static void createSpan() {
97+
private void createSpan() {
9898
Span span = tracer.spanBuilder("POST /search").startSpan();
9999
try (Scope ignored = span.makeCurrent()) {
100100
span.setAllAttributes(SPAN_ATTRIBUTES);
@@ -109,10 +109,10 @@ void runPipeline() {
109109
long endTimeNanos = startTimeNanos + TimeUnit.SECONDS.toNanos(60);
110110
try {
111111
while (System.nanoTime() < endTimeNanos) {
112-
SpanPipelineOtlpBenchmark.createSpan();
112+
createSpan();
113113
}
114114
} finally {
115-
SpanPipelineOtlpBenchmark.tearDown();
115+
tearDown();
116116
}
117117
}
118118
}

exporters/prometheus/src/test/java/io/opentelemetry/exporter/prometheus/CollectorIntegrationTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
* running in process, allowing assertions to be made against the data.
5757
*/
5858
@Testcontainers(disabledWithoutDocker = true)
59+
@SuppressWarnings("NonFinalStaticField")
5960
class CollectorIntegrationTest {
6061

6162
private static final String COLLECTOR_IMAGE =

exporters/prometheus/src/test/java/io/opentelemetry/exporter/prometheus/PrometheusHttpServerTest.java

+3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@
5858
class PrometheusHttpServerTest {
5959
private static final AtomicReference<List<MetricData>> metricData = new AtomicReference<>();
6060

61+
@SuppressWarnings("NonFinalStaticField")
6162
static PrometheusHttpServer prometheusServer;
63+
64+
@SuppressWarnings("NonFinalStaticField")
6265
static WebClient client;
6366

6467
@RegisterExtension

exporters/prometheus/src/test/java/io/opentelemetry/exporter/prometheus/PrometheusIntegrationTest.java

+3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
@Testcontainers(disabledWithoutDocker = true)
3636
class PrometheusIntegrationTest {
3737

38+
@SuppressWarnings("NonFinalStaticField")
3839
private static SdkMeterProvider meterProvider;
40+
41+
@SuppressWarnings("NonFinalStaticField")
3942
private static GenericContainer<?> prometheus;
4043

4144
@BeforeAll

exporters/zipkin/src/test/java/io/opentelemetry/exporter/zipkin/ZipkinSpanExporterEndToEndHttpTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class ZipkinSpanExporterEndToEndHttpTest {
8181
SEEN_ATTRIBUTES.toBuilder().put(AttributeKey.booleanKey("success"), false).build();
8282

8383
@Container
84-
public static GenericContainer<?> zipkinContainer =
84+
public static final GenericContainer<?> zipkinContainer =
8585
new GenericContainer<>("ghcr.io/openzipkin/zipkin:2.23")
8686
.withExposedPorts(ZIPKIN_API_PORT)
8787
.waitingFor(Wait.forHttp("/health").forPort(ZIPKIN_API_PORT));

integration-tests/otlp/src/main/java/io/opentelemetry/integrationtest/OtlpExporterIntegrationTest.java

+3
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ abstract class OtlpExporterIntegrationTest {
124124
@RegisterExtension
125125
static final SelfSignedCertificateExtension clientTls = new SelfSignedCertificateExtension();
126126

127+
@SuppressWarnings("NonFinalStaticField")
127128
private static OtlpGrpcServer grpcServer;
129+
130+
@SuppressWarnings("NonFinalStaticField")
128131
private static GenericContainer<?> collector;
129132

130133
@BeforeAll

integration-tests/src/test/java/io/opentelemetry/B3PropagationIntegrationTest.java

+3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ class B3PropagationIntegrationTest {
5050

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

53+
@SuppressWarnings("NonFinalStaticField")
5354
static WebClient b3MultiClient;
55+
56+
@SuppressWarnings("NonFinalStaticField")
5457
static WebClient b3SingleClient;
5558

5659
private static class FrontendService implements HttpService {

opentracing-shim/src/test/java/io/opentelemetry/opentracingshim/TracerShimTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ class TracerShimTest {
4545
static final io.opentelemetry.api.baggage.Baggage EMPTY_BAGGAGE =
4646
io.opentelemetry.api.baggage.Baggage.empty();
4747

48-
@RegisterExtension static OpenTelemetryExtension otelTesting = OpenTelemetryExtension.create();
48+
@RegisterExtension
49+
static final OpenTelemetryExtension otelTesting = OpenTelemetryExtension.create();
4950

5051
TracerShim tracerShim;
5152
TracerProvider provider;

perf-harness/src/test/java/io/opentelemetry/perf/OtlpPipelineStressTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ public class OtlpPipelineStressTest {
6161
public static final int OTLP_RECEIVER_PORT = 4317;
6262
public static final int COLLECTOR_PROXY_PORT = 44444;
6363
public static final int TOXIPROXY_CONTROL_PORT = 8474;
64-
public static Network network = Network.newNetwork();
65-
public static AtomicLong totalSpansReceivedByCollector = new AtomicLong();
64+
public static final Network network = Network.newNetwork();
65+
public static final AtomicLong totalSpansReceivedByCollector = new AtomicLong();
6666

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

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

9595
@Container
96-
public static GenericContainer<?> toxiproxyContainer =
96+
public static final GenericContainer<?> toxiproxyContainer =
9797
new GenericContainer<>(
9898
DockerImageName.parse("ghcr.io/open-telemetry/opentelemetry-java/toxiproxy"))
9999
.withImagePullPolicy(PullPolicy.alwaysPull())

sdk-extensions/jaeger-remote-sampler/src/test/java/io/opentelemetry/sdk/extension/trace/jaeger/sampler/JaegerRemoteSamplerIntegrationTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class JaegerRemoteSamplerIntegrationTest {
3535
private static final String SERVICE_NAME_DEFAULT_STRATEGY = "foobar";
3636

3737
@Container
38-
public static GenericContainer<?> jaegerContainer =
38+
public static final GenericContainer<?> jaegerContainer =
3939
new GenericContainer<>("ghcr.io/open-telemetry/opentelemetry-java/jaeger:1.32")
4040
.withImagePullPolicy(PullPolicy.alwaysPull())
4141
.withCommand("--sampling.strategies-file=/sampling.json")

sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/debug/DebugConfig.java

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
public final class DebugConfig {
1717
private static final String ENABLE_METRICS_DEBUG_PROPERTY = "otel.experimental.sdk.metrics.debug";
18+
19+
@SuppressWarnings("NonFinalStaticField")
1820
private static boolean enabled;
1921

2022
private DebugConfig() {}

sdk/testing/src/main/java/io/opentelemetry/sdk/testing/context/SettableContextStorageProvider.java

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public static ContextStorage getContextStorage() {
3434
private enum SettableContextStorage implements ContextStorage {
3535
INSTANCE;
3636

37+
@SuppressWarnings("NonFinalStaticField")
3738
private static volatile ContextStorage delegate = createStorage();
3839

3940
@Override

sdk/trace/src/jmh/java/io/opentelemetry/sdk/trace/ExceptionBenchmark.java

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
@State(Scope.Benchmark)
2727
public class ExceptionBenchmark {
28+
@SuppressWarnings("NonFinalStaticField")
2829
private static SpanBuilder spanBuilder;
2930

3031
@Setup(Level.Trial)

sdk/trace/src/jmh/java/io/opentelemetry/sdk/trace/SpanBenchmark.java

+2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424

2525
@State(Scope.Benchmark)
2626
public class SpanBenchmark {
27+
@SuppressWarnings("NonFinalStaticField")
2728
private static SdkSpanBuilder sdkSpanBuilder;
29+
2830
private final Resource serviceResource =
2931
Resource.create(
3032
Attributes.builder()

0 commit comments

Comments
 (0)