Skip to content

Commit 2340283

Browse files
committed
Adjustments to keep native-image builder happy
1 parent f841564 commit 2340283

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package datadog.trace.agent.jmxfetch;
2+
3+
import java.io.InputStream;
4+
5+
/**
6+
* We map the legacy {@code org.yaml.snakeyaml.Yaml} class to this substitute class at build time to
7+
* keep the GraalVM native-image builder happy. JmxFetch has a solitary reference to the class, but
8+
* it's never called because JMXFetch discovers the embedded snakeyaml-engine library and uses that.
9+
*/
10+
public class LegacyYaml {
11+
public <T> T load(InputStream in) {
12+
throw new UnsupportedOperationException();
13+
}
14+
15+
public String dump(Object data) {
16+
throw new UnsupportedOperationException();
17+
}
18+
}

dd-java-agent/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ def generalShadowJarConfig(ShadowJar shadowJarTask) {
156156
// Prevents conflict with other instances, but doesn't relocate instrumentation
157157
if (!projectName.equals('instrumentation')) {
158158
relocate 'org.snakeyaml.engine', 'datadog.snakeyaml.engine'
159+
relocate 'org.yaml.snakeyaml.Yaml', 'datadog.trace.agent.jmxfetch.LegacyYaml'
159160
relocate 'okhttp3', 'datadog.okhttp3'
160161
relocate 'okio', 'datadog.okio'
161162

0 commit comments

Comments
 (0)