Skip to content

Commit 9b97ac7

Browse files
fix(deps): update errorproneversion to v2.37.0 (minor) (#13552)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Lauri Tulmin <[email protected]>
1 parent 5626e25 commit 9b97ac7

File tree

17 files changed

+73
-71
lines changed

17 files changed

+73
-71
lines changed

conventions/src/main/kotlin/otel.errorprone-conventions.gradle.kts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ dependencies {
1010
}
1111

1212
val disableErrorProne = properties["disableErrorProne"]?.toString()?.toBoolean() ?: false
13+
val testLatestDeps = gradle.startParameter.projectProperties["testLatestDeps"] == "true"
1314

1415
tasks {
1516
withType<JavaCompile>().configureEach {
@@ -123,6 +124,16 @@ tasks {
123124

124125
disable("NonFinalStaticField")
125126

127+
// We get this warning in modules that compile for old java versions
128+
disable("StringConcatToTextBlock")
129+
130+
if (testLatestDeps) {
131+
// Some latest dep tests are compiled for java 17 although the base version uses an older
132+
// version. Disable rules that suggest using new language features.
133+
disable("StatementSwitchToExpressionSwitch")
134+
disable("PatternMatchingInstanceof")
135+
}
136+
126137
if (name.contains("Jmh") || name.contains("Test")) {
127138
// Allow underscore in test-type method names
128139
disable("MemberName")

custom-checks/src/test/java/io/opentelemetry/javaagent/customchecks/OtelInternalJavadocTest.java

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,47 @@ class OtelInternalJavadocTest {
1212

1313
@Test
1414
void test() {
15-
doTest("internal/InternalJavadocPositiveCases.java");
16-
doTest("internal/InternalJavadocNegativeCases.java");
15+
doTest(
16+
"internal/InternalJavadocPositiveCases.java",
17+
"""
18+
package io.opentelemetry.javaagent.customchecks.internal;
19+
20+
// BUG: Diagnostic contains: doesn't end with any of the applicable javadoc disclaimers
21+
public class InternalJavadocPositiveCases {
22+
23+
// BUG: Diagnostic contains: doesn't end with any of the applicable javadoc disclaimers
24+
public static class One {}
25+
26+
/** Doesn't have the disclaimer. */
27+
// BUG: Diagnostic contains: doesn't end with any of the applicable javadoc disclaimers
28+
public static class Two {}
29+
}
30+
""");
31+
doTest(
32+
"internal/InternalJavadocNegativeCases.java",
33+
"""
34+
package io.opentelemetry.javaagent.customchecks.internal;
35+
36+
/**
37+
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
38+
* any time.
39+
*/
40+
public class InternalJavadocNegativeCases {
41+
42+
/**
43+
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
44+
* any time.
45+
*/
46+
public static class One {}
47+
48+
static class Two {}
49+
}
50+
""");
1751
}
1852

19-
private static void doTest(String path) {
53+
private static void doTest(String path, String... lines) {
2054
CompilationTestHelper.newInstance(OtelInternalJavadoc.class, OtelInternalJavadocTest.class)
21-
.addSourceFile(path)
55+
.addSourceLines(path, lines)
2256
.doTest();
2357
}
2458
}

custom-checks/src/test/resources/io/opentelemetry/javaagent/customchecks/internal/InternalJavadocNegativeCases.java

Lines changed: 0 additions & 21 deletions
This file was deleted.

custom-checks/src/test/resources/io/opentelemetry/javaagent/customchecks/internal/InternalJavadocPositiveCases.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

dependencyManagement/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ val DEPENDENCY_BOMS = listOf(
3838

3939
val autoServiceVersion = "1.1.1"
4040
val autoValueVersion = "1.11.0"
41-
val errorProneVersion = "2.36.0"
41+
val errorProneVersion = "2.37.0"
4242
val byteBuddyVersion = "1.17.4"
4343
val asmVersion = "9.7.1"
4444
val jmhVersion = "1.37"

instrumentation/activej-http-6.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/activejhttp/ActivejHttpServerAttributesGetter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public String getUrlQuery(HttpRequest request) {
7474
}
7575

7676
@Override
77+
@SuppressWarnings("UnnecessaryDefaultInEnumSwitch")
7778
public String getNetworkProtocolName(HttpRequest request, @Nullable HttpResponse httpResponse) {
7879
return switch (request.getVersion()) {
7980
case HTTP_0_9, HTTP_1_0, HTTP_1_1, HTTP_2_0 -> "http";
@@ -82,6 +83,7 @@ public String getNetworkProtocolName(HttpRequest request, @Nullable HttpResponse
8283
}
8384

8485
@Override
86+
@SuppressWarnings("UnnecessaryDefaultInEnumSwitch")
8587
public String getNetworkProtocolVersion(
8688
HttpRequest request, @Nullable HttpResponse httpResponse) {
8789
return switch (request.getVersion()) {

instrumentation/elasticsearch/elasticsearch-transport-6.0/javaagent/src/elasticsearch6Test/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/transport/v6_0/Elasticsearch6NodeFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public Node newNode(Settings settings) {
1818
InternalSettingsPreparer.prepareEnvironment(settings, null),
1919
Collections.singleton(Netty4Plugin.class)) {
2020

21+
@SuppressWarnings({"UnusedMethod", "UnusedVariable"})
2122
protected void registerDerivedNodeNameWithLogger(String s) {}
2223
};
2324
}

instrumentation/hibernate/hibernate-6.0/spring-testing/src/test/java/spring/jpa/Customer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,9 @@ public boolean equals(@Nullable Object obj) {
6565
if (obj == this) {
6666
return true;
6767
}
68-
if (!(obj instanceof Customer)) {
68+
if (!(obj instanceof Customer other)) {
6969
return false;
7070
}
71-
Customer other = (Customer) obj;
7271
return Objects.equals(id, other.id)
7372
&& Objects.equals(firstName, other.firstName)
7473
&& Objects.equals(lastName, other.lastName);

instrumentation/jetty/jetty-12.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/v12_0/Jetty12HttpAttributesGetter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ public String getNetworkProtocolVersion(Request request, @Nullable Response unus
8686
public InetSocketAddress getNetworkPeerInetSocketAddress(
8787
Request request, @Nullable Response unused) {
8888
SocketAddress address = request.getConnectionMetaData().getRemoteSocketAddress();
89-
return address instanceof InetSocketAddress ? (InetSocketAddress) address : null;
89+
return address instanceof InetSocketAddress inetSocketAddress ? inetSocketAddress : null;
9090
}
9191

9292
@Nullable
9393
@Override
9494
public InetSocketAddress getNetworkLocalInetSocketAddress(
9595
Request request, @Nullable Response unused) {
9696
SocketAddress address = request.getConnectionMetaData().getLocalSocketAddress();
97-
return address instanceof InetSocketAddress ? (InetSocketAddress) address : null;
97+
return address instanceof InetSocketAddress inetSocketAddress ? inetSocketAddress : null;
9898
}
9999
}

instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/ThreadGrouper.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ public final class ThreadGrouper {
1919
@Nullable
2020
public String groupedName(RecordedEvent ev) {
2121
Object thisField = ev.getValue("eventThread");
22-
if (thisField instanceof RecordedThread) {
23-
RecordedThread thread = (RecordedThread) thisField;
22+
if (thisField instanceof RecordedThread thread) {
2423
return thread.getJavaName();
2524
}
2625
return null;

0 commit comments

Comments
 (0)