File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/api Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ package datadog .trace .bootstrap .instrumentation .api ;
2+
3+ import datadog .context .Context ;
4+
5+ /**
6+ * A helper for accessing methods that rely on new Java 8 bytecode features such as calling a static
7+ * interface methods. In instrumentation, we may need to call these methods in code that is inlined
8+ * into an instrumented class, however many times the instrumented class has been compiled to a
9+ * previous version of bytecode, and so we cannot inline calls to static interface methods, as those
10+ * were not supported prior to Java 8 and will lead to a class verification error.
11+ */
12+ public class Java8BytecodeBridge {
13+ /** @see Context#root() */
14+ public static Context getRootContext () {
15+ return Context .root ();
16+ }
17+
18+ /** @see Context#current() */
19+ public static Context getCurrentContext () {
20+ return Context .current ();
21+ }
22+
23+ /** @see Context#from(Object) */
24+ public static Context getContextFrom (Object carrier ) {
25+ return Context .from (carrier );
26+ }
27+
28+ /** @see Context#detachFrom(Object) */
29+ public static Context detachContextFrom (Object carrier ) {
30+ return Context .detachFrom (carrier );
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments