From 6ad303e5ec83f03b24b2699d999ce2382ad9a95a Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Fri, 10 Jan 2025 09:45:30 +0200 Subject: [PATCH] remove unneeded things --- .../instrumentation/apachedubbo/v2_7/DubboHeadersGetter.java | 5 ++--- .../apachedubbo/v2_7/DubboHeadersGetterTest.java | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboHeadersGetter.java b/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboHeadersGetter.java index 8a90da1302c2..ff3c3c76e8fa 100644 --- a/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboHeadersGetter.java +++ b/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboHeadersGetter.java @@ -21,10 +21,9 @@ enum DubboHeadersGetter implements TextMapGetter { MethodHandles.Lookup lookup = MethodHandles.lookup(); MethodHandle getObjectAttachments = null; try { - Class rpcInvocation = Class.forName("org.apache.dubbo.rpc.RpcInvocation"); getObjectAttachments = lookup.findVirtual( - rpcInvocation, "getObjectAttachments", MethodType.methodType(Map.class)); + RpcInvocation.class, "getObjectAttachments", MethodType.methodType(Map.class)); } catch (Throwable t) { // ignore } @@ -32,7 +31,7 @@ enum DubboHeadersGetter implements TextMapGetter { } @Override - @SuppressWarnings("unchecked") // unchecked for 2.7.6, 2.7.7 + @SuppressWarnings("unchecked") public Iterable keys(DubboRequest request) { RpcInvocation invocation = request.invocation(); try { diff --git a/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/test/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboHeadersGetterTest.java b/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/test/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboHeadersGetterTest.java index 627e5e5d5403..fad042e388f6 100644 --- a/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/test/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboHeadersGetterTest.java +++ b/instrumentation/apache-dubbo-2.7/library-autoconfigure/src/test/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboHeadersGetterTest.java @@ -27,7 +27,6 @@ class DubboHeadersGetterTest { @Mock RpcInvocation rpcInvocation; @Test - @SuppressWarnings("deprecation") // deprecation for RpcInvocation() void testKeys() throws Exception { when(context.getUrl()).thenReturn(new URL("http", "localhost", 1)); when(context.getRemoteAddress()).thenReturn(new InetSocketAddress(1));