diff --git a/instrumentation/classloaders/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/javaclassloader/ClassLoaderInstrumentation.java b/instrumentation/classloaders/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/javaclassloader/ClassLoaderInstrumentation.java index 33c4175ffdfa..6e1fceabf011 100644 --- a/instrumentation/classloaders/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/javaclassloader/ClassLoaderInstrumentation.java +++ b/instrumentation/classloaders/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/javaclassloader/ClassLoaderInstrumentation.java @@ -62,11 +62,11 @@ public Map, String> transfor .and(named("loadClass")) .and( takesArguments(1) - .and(takesArgument(0, named("java.lang.String"))) + .and(takesArgument(0, String.class)) .or( takesArguments(2) - .and(takesArgument(0, named("java.lang.String"))) - .and(takesArgument(1, named("boolean"))))) + .and(takesArgument(0, String.class)) + .and(takesArgument(1, boolean.class)))) .and(isPublic().or(isProtected())) .and(not(isStatic())), ClassLoaderInstrumentation.class.getName() + "$LoadClassAdvice"); diff --git a/instrumentation/couchbase/couchbase-2.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_6/CouchbaseNetworkInstrumentation.java b/instrumentation/couchbase/couchbase-2.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_6/CouchbaseNetworkInstrumentation.java index 1fdd4b1529f5..3e53c5b03e5f 100644 --- a/instrumentation/couchbase/couchbase-2.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_6/CouchbaseNetworkInstrumentation.java +++ b/instrumentation/couchbase/couchbase-2.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/couchbase/v2_6/CouchbaseNetworkInstrumentation.java @@ -21,6 +21,7 @@ import io.opentelemetry.javaagent.instrumentation.api.InstrumentationContext; import io.opentelemetry.javaagent.tooling.TypeInstrumentation; import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import java.util.List; import java.util.Map; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; @@ -52,7 +53,7 @@ public Map, String> transfor .and( takesArgument( 0, named("com.couchbase.client.deps.io.netty.channel.ChannelHandlerContext"))) - .and(takesArgument(2, named("java.util.List"))), + .and(takesArgument(2, List.class)), CouchbaseNetworkInstrumentation.class.getName() + "$CouchbaseNetworkAdvice"); } diff --git a/instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/v5_0/Elasticsearch5RestClientInstrumentationModule.java b/instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/v5_0/Elasticsearch5RestClientInstrumentationModule.java index 9b274430f5b9..9c358774db85 100644 --- a/instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/v5_0/Elasticsearch5RestClientInstrumentationModule.java +++ b/instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/v5_0/Elasticsearch5RestClientInstrumentationModule.java @@ -52,8 +52,8 @@ public Map, String> transfor isMethod() .and(namedOneOf("performRequestAsync", "performRequestAsyncNoCatch")) .and(takesArguments(7)) - .and(takesArgument(0, named("java.lang.String"))) // method - .and(takesArgument(1, named("java.lang.String"))) // endpoint + .and(takesArgument(0, String.class)) // method + .and(takesArgument(1, String.class)) // endpoint .and(takesArgument(5, named("org.elasticsearch.client.ResponseListener"))), Elasticsearch5RestClientInstrumentationModule.class.getName() + "$ElasticsearchRestClientAdvice"); diff --git a/instrumentation/geode-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/geode/GeodeInstrumentationModule.java b/instrumentation/geode-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/geode/GeodeInstrumentationModule.java index 8bbebaa42ad4..3867d9dc05db 100644 --- a/instrumentation/geode-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/geode/GeodeInstrumentationModule.java +++ b/instrumentation/geode-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/geode/GeodeInstrumentationModule.java @@ -74,7 +74,7 @@ public Map, String> transfor map.put( isMethod() .and(named("existsValue").or(named("query")).or(named("selectValue"))) - .and(takesArgument(0, named("java.lang.String"))), + .and(takesArgument(0, String.class)), GeodeInstrumentationModule.class.getName() + "$QueryAdvice"); return map; } diff --git a/instrumentation/google-http-client-1.19/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/googlehttpclient/GoogleHttpClientInstrumentationModule.java b/instrumentation/google-http-client-1.19/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/googlehttpclient/GoogleHttpClientInstrumentationModule.java index 762c6843476c..acd894d7f81d 100644 --- a/instrumentation/google-http-client-1.19/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/googlehttpclient/GoogleHttpClientInstrumentationModule.java +++ b/instrumentation/google-http-client-1.19/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/googlehttpclient/GoogleHttpClientInstrumentationModule.java @@ -26,6 +26,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.Executor; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.description.type.TypeDescription; @@ -68,7 +69,7 @@ public Map, String> transfor .and(isPublic()) .and(named("executeAsync")) .and(takesArguments(1)) - .and(takesArgument(0, (named("java.util.concurrent.Executor")))), + .and(takesArgument(0, Executor.class)), GoogleHttpClientInstrumentationModule.class.getName() + "$GoogleHttpClientAsyncAdvice"); return transformers; diff --git a/instrumentation/grizzly-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grizzly/DefaultFilterChainInstrumentation.java b/instrumentation/grizzly-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grizzly/DefaultFilterChainInstrumentation.java index 356ad2b00af4..ebc19cec6b6f 100644 --- a/instrumentation/grizzly-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grizzly/DefaultFilterChainInstrumentation.java +++ b/instrumentation/grizzly-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grizzly/DefaultFilterChainInstrumentation.java @@ -31,7 +31,7 @@ public Map, String> transfor .and(isPrivate()) .and(named("notifyFailure")) .and(takesArgument(0, named("org.glassfish.grizzly.filterchain.FilterChainContext"))) - .and(takesArgument(1, named("java.lang.Throwable"))), + .and(takesArgument(1, Throwable.class)), DefaultFilterChainAdvice.class.getName()); } } diff --git a/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/SessionInstrumentation.java b/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/SessionInstrumentation.java index 89cba7d1cab3..78e83693e9cf 100644 --- a/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/SessionInstrumentation.java +++ b/instrumentation/hibernate/hibernate-3.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v3_3/SessionInstrumentation.java @@ -79,10 +79,7 @@ public Map, String> transfor // Handle the non-generic 'get' separately. transformers.put( - isMethod() - .and(named("get")) - .and(returns(named("java.lang.Object"))) - .and(takesArgument(0, named("java.lang.String"))), + isMethod().and(named("get")).and(returns(Object.class)).and(takesArgument(0, String.class)), SessionInstrumentation.class.getName() + "$SessionMethodAdvice"); // These methods return some object that we want to instrument, and so the Advice will pin the diff --git a/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/SessionInstrumentation.java b/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/SessionInstrumentation.java index e396e383a8b2..88063c74e731 100644 --- a/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/SessionInstrumentation.java +++ b/instrumentation/hibernate/hibernate-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hibernate/v4_0/SessionInstrumentation.java @@ -76,10 +76,7 @@ public Map, String> transfor SessionInstrumentation.class.getName() + "$SessionMethodAdvice"); // Handle the non-generic 'get' separately. transformers.put( - isMethod() - .and(named("get")) - .and(returns(named("java.lang.Object"))) - .and(takesArgument(0, named("java.lang.String"))), + isMethod().and(named("get")).and(returns(Object.class)).and(takesArgument(0, String.class)), SessionInstrumentation.class.getName() + "$SessionMethodAdvice"); // These methods return some object that we want to instrument, and so the Advice will pin the diff --git a/instrumentation/jetty-8.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/JettyInstrumentationModule.java b/instrumentation/jetty-8.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/JettyInstrumentationModule.java index e683a8fa3fd0..51ceae3d2dee 100644 --- a/instrumentation/jetty-8.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/JettyInstrumentationModule.java +++ b/instrumentation/jetty-8.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/JettyInstrumentationModule.java @@ -63,7 +63,7 @@ public ElementMatcher typeMatcher() { public Map, String> transformers() { return singletonMap( named("handle") - .and(takesArgument(0, named("java.lang.String"))) + .and(takesArgument(0, String.class)) .and(takesArgument(1, named("org.eclipse.jetty.server.Request"))) .and(takesArgument(2, named("javax.servlet.http.HttpServletRequest"))) .and(takesArgument(3, named("javax.servlet.http.HttpServletResponse"))) diff --git a/instrumentation/khttp-0.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/khttp/KHttpInstrumentationModule.java b/instrumentation/khttp-0.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/khttp/KHttpInstrumentationModule.java index 6364e37bdf9f..3741b9e25796 100644 --- a/instrumentation/khttp-0.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/khttp/KHttpInstrumentationModule.java +++ b/instrumentation/khttp-0.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/khttp/KHttpInstrumentationModule.java @@ -54,9 +54,9 @@ public Map, String> transfor isMethod() .and(not(isAbstract())) .and(named("request")) - .and(takesArgument(0, named("java.lang.String"))) - .and(takesArgument(1, named("java.lang.String"))) - .and(takesArgument(2, named("java.util.Map"))) + .and(takesArgument(0, String.class)) + .and(takesArgument(1, String.class)) + .and(takesArgument(2, Map.class)) .and(returns(named("khttp.responses.Response"))), KHttpAdvice.class.getName()); } diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceReactiveCommandsInstrumentation.java b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceReactiveCommandsInstrumentation.java index 65e8836c0cd2..d04aa57ef45c 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceReactiveCommandsInstrumentation.java +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceReactiveCommandsInstrumentation.java @@ -18,6 +18,7 @@ import io.opentelemetry.javaagent.tooling.TypeInstrumentation; import java.util.HashMap; import java.util.Map; +import java.util.function.Supplier; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.matcher.ElementMatcher; @@ -35,7 +36,7 @@ public Map, String> transfor transformers.put( isMethod() .and(named("createMono")) - .and(takesArgument(0, named("java.util.function.Supplier"))) + .and(takesArgument(0, Supplier.class)) .and(returns(named("reactor.core.publisher.Mono"))), LettuceMonoCreationAdvice.class.getName()); transformers.put( @@ -43,7 +44,7 @@ public Map, String> transfor .and(nameStartsWith("create")) .and(nameEndsWith("Flux")) .and(isPublic()) - .and(takesArgument(0, named("java.util.function.Supplier"))) + .and(takesArgument(0, Supplier.class)) .and(returns(named("reactor.core.publisher.Flux"))), LettuceFluxCreationAdvice.class.getName()); diff --git a/instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/client/RmiClientInstrumentationModule.java b/instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/client/RmiClientInstrumentationModule.java index aafa55ffdf24..36c450f4da9b 100644 --- a/instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/client/RmiClientInstrumentationModule.java +++ b/instrumentation/rmi/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/rmi/client/RmiClientInstrumentationModule.java @@ -51,7 +51,7 @@ public Map, String> transfor isMethod() .and(named("invoke")) .and(takesArgument(0, named("java.rmi.Remote"))) - .and(takesArgument(1, named("java.lang.reflect.Method"))), + .and(takesArgument(1, Method.class)), RmiClientInstrumentationModule.class.getName() + "$RmiClientAdvice"); } } diff --git a/instrumentation/spring/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/server/HandlerAdapterInstrumentation.java b/instrumentation/spring/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/server/HandlerAdapterInstrumentation.java index 5f92190bceae..49d9afa71e19 100644 --- a/instrumentation/spring/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/server/HandlerAdapterInstrumentation.java +++ b/instrumentation/spring/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/server/HandlerAdapterInstrumentation.java @@ -42,7 +42,7 @@ public Map, String> transfor .and(isPublic()) .and(named("handle")) .and(takesArgument(0, named("org.springframework.web.server.ServerWebExchange"))) - .and(takesArgument(1, named("java.lang.Object"))) + .and(takesArgument(1, Object.class)) .and(takesArguments(2)), HandlerAdapterAdvice.class.getName()); } diff --git a/instrumentation/vertx-reactive-3.5/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/reactive/VertxRxInstrumentationModule.java b/instrumentation/vertx-reactive-3.5/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/reactive/VertxRxInstrumentationModule.java index 79b2d3bf28b6..fb3662163a4e 100644 --- a/instrumentation/vertx-reactive-3.5/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/reactive/VertxRxInstrumentationModule.java +++ b/instrumentation/vertx-reactive-3.5/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/reactive/VertxRxInstrumentationModule.java @@ -60,7 +60,7 @@ public Map, String> transfor isConstructor().and(takesArgument(0, named("io.vertx.core.Handler"))), VertxRxInstrumentationModule.class.getName() + "$AsyncResultSingleHandlerAdvice"); result.put( - isConstructor().and(takesArgument(0, named("java.util.function.Consumer"))), + isConstructor().and(takesArgument(0, Consumer.class)), VertxRxInstrumentationModule.class.getName() + "$AsyncResultSingleConsumerAdvice"); return result; }