Skip to content

Commit 95cc300

Browse files
authored
Compile runtime-telemetry-java17 for java8 (open-telemetry#13679)
1 parent 29ea551 commit 95cc300

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

instrumentation/runtime-telemetry/runtime-telemetry-java17/library/build.gradle.kts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,14 @@ tasks {
5858
dependsOn(testSerial)
5959
}
6060

61-
tasks {
62-
compileJava {
63-
// We compile this module for java 8 because it is used as a dependency in spring-boot-autoconfigure.
64-
// If this module is compiled for java 17 then gradle can figure out based on the metadata that
65-
// spring-boot-autoconfigure has a dependency that requires 17 and fails the build when it is used
66-
// in a project that targets an earlier java version.
67-
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/13384
68-
sourceCompatibility = "1.8"
69-
targetCompatibility = "1.8"
70-
options.release.set(null as Int?)
71-
}
61+
compileJava {
62+
// We compile this module for java 8 because it is used as a dependency in spring-boot-autoconfigure.
63+
// If this module is compiled for java 17 then gradle can figure out based on the metadata that
64+
// spring-boot-autoconfigure has a dependency that requires 17 and fails the build when it is used
65+
// in a project that targets an earlier java version.
66+
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/13384
67+
sourceCompatibility = "1.8"
68+
targetCompatibility = "1.8"
69+
options.release.set(null as Int?)
7270
}
7371
}

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

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ private static void doIfAvailable(
128128
return;
129129
}
130130
Object value = event.getValue(field);
131-
if (value instanceof RecordedObject recordedObject) {
132-
closure.accept(recordedObject);
131+
if (value instanceof RecordedObject) {
132+
closure.accept((RecordedObject) value);
133133
}
134134
}
135135

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ private static void doIfAvailable(
145145
return;
146146
}
147147
Object value = event.getValue(field);
148-
if (value instanceof RecordedObject recordedObject) {
149-
closure.accept(recordedObject);
148+
if (value instanceof RecordedObject) {
149+
closure.accept((RecordedObject) value);
150150
}
151151
}
152152

0 commit comments

Comments
 (0)