Skip to content
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
28 changes: 15 additions & 13 deletions dd-java-agent/instrumentation/weaver-0.9/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cafe.cryptography:ed25519-elisabeth:0.1.0=buildTimeInstrumentationPlugin,latestD
ch.qos.logback:logback-classic:1.2.13=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
ch.qos.logback:logback-core:1.2.13=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
co.fs2:fs2-core_3:3.10.2=compileClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
co.fs2:fs2-core_3:3.12.2=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
co.fs2:fs2-core_3:3.13.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
com.blogspot.mydailyjava:weak-lock-free:0.17=buildTimeInstrumentationPlugin,compileClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
com.datadoghq.okhttp3:okhttp:3.12.15=buildTimeInstrumentationPlugin,compileClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
com.datadoghq.okio:okio:1.17.6=buildTimeInstrumentationPlugin,compileClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
Expand All @@ -26,7 +26,6 @@ com.eed3si9n:sjson-new-scalajson_2.13:0.10.1=zinc
com.fasterxml.jackson.core:jackson-annotations:2.20=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
com.fasterxml.jackson.core:jackson-core:2.20.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
com.fasterxml.jackson.core:jackson-databind:2.20.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
com.fasterxml.jackson:jackson-bom:2.20.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
com.github.javaparser:javaparser-core:3.25.6=codenarc
com.github.jnr:jffi:1.3.14=buildTimeInstrumentationPlugin,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath,weaver084TestRuntimeClasspath
com.github.jnr:jnr-a64asm:1.0.0=buildTimeInstrumentationPlugin,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath,weaver084TestRuntimeClasspath
Expand Down Expand Up @@ -181,7 +180,8 @@ org.scala-sbt:zinc-core_2.13:1.10.4=zinc
org.scala-sbt:zinc-persist-core-assembly:1.10.4=zinc
org.scala-sbt:zinc-persist_2.13:1.10.4=zinc
org.scala-sbt:zinc_2.13:1.10.4=zinc
org.scodec:scodec-bits_3:1.1.38=compileClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.scodec:scodec-bits_3:1.1.38=compileClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.scodec:scodec-bits_3:1.2.4=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.skyscreamer:jsonassert:1.5.1=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.slf4j:jcl-over-slf4j:1.7.30=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.slf4j:jul-to-slf4j:1.7.30=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
Expand All @@ -194,25 +194,27 @@ org.slf4j:slf4j-simple:2.0.17=spotbugsSlf4j
org.snakeyaml:snakeyaml-engine:2.9=buildTimeInstrumentationPlugin,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath,weaver084TestRuntimeClasspath
org.spockframework:spock-bom:2.4-groovy-3.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.spockframework:spock-core:2.4-groovy-3.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.tabletest:tabletest-junit:1.2.1=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.tabletest:tabletest-parser:1.2.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.typelevel:cats-core_3:2.10.0=compileClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.typelevel:cats-core_3:2.11.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:cats-core_3:2.13.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:cats-effect-kernel_3:3.5.4=compileClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.typelevel:cats-effect-kernel_3:3.6.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:cats-effect-kernel_3:3.7.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:cats-effect-std_3:3.5.4=compileClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.typelevel:cats-effect-std_3:3.6.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:cats-effect-std_3:3.7.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:cats-effect_3:3.5.4=compileClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.typelevel:cats-effect_3:3.6.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:cats-effect_3:3.7.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:cats-kernel_3:2.10.0=compileClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.typelevel:cats-kernel_3:2.11.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:cats-mtl_3:1.3.1=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:cats-kernel_3:2.13.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:cats-mtl_3:1.6.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:scalac-compat-annotation_3:0.1.4=compileClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.typelevel:weaver-cats-core_3:0.11.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:weaver-cats-core_3:0.12.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:weaver-cats-core_3:0.9.0=compileClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.typelevel:weaver-cats_3:0.11.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:weaver-cats_3:0.12.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:weaver-cats_3:0.9.0=compileClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.typelevel:weaver-core_3:0.11.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:weaver-core_3:0.12.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:weaver-core_3:0.9.0=compileClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.typelevel:weaver-framework_3:0.11.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:weaver-framework_3:0.12.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath
org.typelevel:weaver-framework_3:0.9.0=compileClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
org.xmlresolver:xmlresolver:5.3.3=spotbugs
org.xmlunit:xmlunit-core:2.10.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,weaver084TestCompileClasspath,weaver084TestRuntimeClasspath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"env" : "none",
"error.message" : ${content_meta_error_message},
"error.stack" : ${content_meta_error_stack},
"error.type" : "weaver.ExpectationFailed",
"error.type" : "java.lang.RuntimeException",
"language" : "jvm",
"library_version" : ${content_meta_library_version},
"runtime-id" : ${content_meta_runtime_id},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"env" : "none",
"error.message" : ${content_meta_error_message},
"error.stack" : ${content_meta_error_stack},
"error.type" : "weaver.ExpectationFailed",
"error.type" : "java.lang.RuntimeException",
"language" : "jvm",
"library_version" : ${content_meta_library_version},
"runtime-id" : ${content_meta_runtime_id},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,17 @@ public static void onTestFinished(TestFinished event, TaskDef taskDef) {
if (testOutcome.result() != null) {
// Failed outcomes
if (WeaverUtils.isResultFailure(testOutcome.result())) {
Throwable throwable =
WeaverUtils.unwrap(
WeaverUtils.METHOD_HANDLES.invoke(
WeaverUtils.GET_FAILURE_SOURCE_HANDLE, testOutcome.result()),
Throwable.class);
Object source =
WeaverUtils.METHOD_HANDLES.invoke(
WeaverUtils.GET_FAILURE_SOURCE_HANDLE, testOutcome.result());
Throwable throwable = WeaverUtils.toThrowable(source);
TEST_EVENTS_HANDLER.onTestFailure(testDescriptor, throwable);
} else if (testOutcome.result() instanceof Result.Failures) {
Result.Failures result = (Result.Failures) testOutcome.result();
Object headFailure = result.failures().head();
Throwable throwable =
WeaverUtils.unwrap(
WeaverUtils.METHOD_HANDLES.invoke(
WeaverUtils.GET_FAILURE_SOURCE_HANDLE, headFailure),
Throwable.class);
Object source =
WeaverUtils.METHOD_HANDLES.invoke(WeaverUtils.GET_FAILURE_SOURCE_HANDLE, headFailure);
Throwable throwable = WeaverUtils.toThrowable(source);
TEST_EVENTS_HANDLER.onTestFailure(testDescriptor, throwable);
} else if (testOutcome.result() instanceof Result.Exception) {
Result.Exception result = (Result.Exception) testOutcome.result();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public abstract class WeaverUtils {
private static final String RESULT_FAILURES_FAILURE_CLASS_NAME = "weaver.Result$Failures$Failure";
// - Failure.source changed from Optional<Throwable> to Throwable
public static final MethodHandle GET_FAILURE_SOURCE_HANDLE = createFailureSourceHandle();
// - In v0.12.0, ExpectationFailed is no longer a Throwable
private static final String EXPECTATION_FAILED_CLASS_NAME = "weaver.ExpectationFailed";
private static final MethodHandle GET_EXPECTATION_FAILED_MESSAGE_HANDLE =
METHOD_HANDLES.method(getClass(EXPECTATION_FAILED_CLASS_NAME), "message");

public static final List<LibraryCapability> CAPABILITIES = Collections.emptyList();

Expand Down Expand Up @@ -103,4 +107,31 @@ public static <T> T unwrap(Object value, Class<T> type) {
return type.cast(value);
}
}

/**
* Converts a failure source to a Throwable. In weaver v0.9–v0.11, the source is a Throwable (or
* Option&lt;Throwable&gt;). In v0.12.0+, ExpectationFailed is no longer a Throwable, so we
* extract its message and wrap it in a RuntimeException.
*/
@Nullable
public static Throwable toThrowable(@Nullable Object source) {
if (source == null) {
return null;
}
if (source instanceof Option) {
source = ((Option<?>) source).getOrElse(null);
if (source == null) {
return null;
}
}
if (source instanceof Throwable) {
return (Throwable) source;
}
// v0.12.0+: ExpectationFailed is no longer a Throwable
if (GET_EXPECTATION_FAILED_MESSAGE_HANDLE != null) {
String message = METHOD_HANDLES.invoke(GET_EXPECTATION_FAILED_MESSAGE_HANDLE, source);
return new RuntimeException(message);
}
return new RuntimeException(source.toString());
}
}
Loading