Stop using `failSafe` matcher
It should not be necessary after we jave fixed class location issue
for ByteBuddy
MODIFY
dd-java-agent/instrumentation/jax-rs-client/src/main/java/datadog/trace/instrumentation/jaxrs/JaxRsClientInstrumentation.java
dd-java-agent/instrumentation/jax-rs-client/src/main/java/datadog/trace/instrumentation/jaxrs/JaxRsClientInstrumentation.java
package datadog.trace.instrumentation.jaxrs;
-import static net.bytebuddy.matcher.ElementMatchers.failSafe;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.returns;
@@ -22,7 +21,7 @@ public final class JaxRsClientInstrumentation extends Instrumenter.Default {
@Override
public ElementMatcher typeMatcher() {
- return failSafe(hasSuperType(named("javax.ws.rs.client.ClientBuilder")));
+ return hasSuperType(named("javax.ws.rs.client.ClientBuilder"));
}
@Override

MODIFY
dd-java-agent/instrumentation/jdbc/src/main/java/datadog/trace/instrumentation/jdbc/ConnectionInstrumentation.java
dd-java-agent/instrumentation/jdbc/src/main/java/datadog/trace/instrumentation/jdbc/ConnectionInstrumentation.java
package datadog.trace.instrumentation.jdbc;
-import static net.bytebuddy.matcher.ElementMatchers.failSafe;
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
import static net.bytebuddy.matcher.ElementMatchers.isSubTypeOf;
import static net.bytebuddy.matcher.ElementMatchers.nameStartsWith;
@@ -27,12 +26,12 @@ public final class ConnectionInstrumentation extends Instrumenter.Default {
@Override
public ElementMatcher typeMatcher() {
- return not(isInterface()).and(failSafe(isSubTypeOf(Connection.class)));
+ return not(isInterface()).and(isSubTypeOf(Connection.class));
}
@Override
public Map<ElementMatcher, String> transformers() {
- Map<ElementMatcher, String> transformers = new HashMap<>();
+ final Map<ElementMatcher, String> transformers = new HashMap<>();
transformers.put(
nameStartsWith("prepare")
.and(takesArgument(0, String.class))

MODIFY
dd-java-agent/instrumentation/jms-1/src/main/java/datadog/trace/instrumentation/jms1/JMS1MessageListenerInstrumentation.java
dd-java-agent/instrumentation/jms-1/src/main/java/datadog/trace/instrumentation/jms1/JMS1MessageListenerInstrumentation.java
@@ -3,7 +3,6 @@ package datadog.trace.instrumentation.jms1;
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
import static datadog.trace.instrumentation.jms.util.JmsUtil.toResourceName;
import static io.opentracing.log.Fields.ERROR_OBJECT;
-import static net.bytebuddy.matcher.ElementMatchers.failSafe;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
@@ -40,7 +39,7 @@ public final class JMS1MessageListenerInstrumentation extends Instrumenter.Defau
@Override
public ElementMatcher typeMatcher() {
- return not(isInterface()).and(failSafe(hasSuperType(named("javax.jms.MessageListener"))));
+ return not(isInterface()).and(hasSuperType(named("javax.jms.MessageListener")));
}
@Override
@@ -55,7 +54,7 @@ public final class JMS1MessageListenerInstrumentation extends Instrumenter.Defau
@Override
public Map<ElementMatcher, String> transformers() {
- Map<ElementMatcher, String> transformers = new HashMap<>();
+ final Map<ElementMatcher, String> transformers = new HashMap<>();
transformers.put(
named("onMessage").and(takesArgument(0, named("javax.jms.Message"))).and(isPublic()),
MessageListenerAdvice.class.getName());

MODIFY
dd-java-agent/instrumentation/jms-1/src/main/java/datadog/trace/instrumentation/jms1/JMS1MessageProducerInstrumentation.java
dd-java-agent/instrumentation/jms-1/src/main/java/datadog/trace/instrumentation/jms1/JMS1MessageProducerInstrumentation.java
@@ -3,7 +3,6 @@ package datadog.trace.instrumentation.jms1;
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
import static datadog.trace.instrumentation.jms.util.JmsUtil.toResourceName;
import static io.opentracing.log.Fields.ERROR_OBJECT;
-import static net.bytebuddy.matcher.ElementMatchers.failSafe;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
@@ -40,7 +39,7 @@ public final class JMS1MessageProducerInstrumentation extends Instrumenter.Defau
@Override
public ElementMatcher typeMatcher() {
- return not(isInterface()).and(failSafe(hasSuperType(named("javax.jms.MessageProducer"))));
+ return not(isInterface()).and(hasSuperType(named("javax.jms.MessageProducer")));
}
@Override
@@ -55,7 +54,7 @@ public final class JMS1MessageProducerInstrumentation extends Instrumenter.Defau
@Override
public Map<ElementMatcher, String> transformers() {
- Map<ElementMatcher, String> transformers = new HashMap<>();
+ final Map<ElementMatcher, String> transformers = new HashMap<>();
transformers.put(
named("send").and(takesArgument(0, named("javax.jms.Message"))).and(isPublic()),
ProducerAdvice.class.getName());

MODIFY
dd-java-agent/instrumentation/jms-2/src/main/java/datadog/trace/instrumentation/jms2/JMS2MessageConsumerInstrumentation.java
dd-java-agent/instrumentation/jms-2/src/main/java/datadog/trace/instrumentation/jms2/JMS2MessageConsumerInstrumentation.java
@@ -3,7 +3,6 @@ package datadog.trace.instrumentation.jms2;
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
import static datadog.trace.instrumentation.jms.util.JmsUtil.toResourceName;
import static io.opentracing.log.Fields.ERROR_OBJECT;
-import static net.bytebuddy.matcher.ElementMatchers.failSafe;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
@@ -47,7 +46,7 @@ public final class JMS2MessageConsumerInstrumentation extends Instrumenter.Defau
@Override
public ElementMatcher typeMatcher() {
- return not(isInterface()).and(failSafe(hasSuperType(named("javax.jms.MessageConsumer"))));
+ return not(isInterface()).and(hasSuperType(named("javax.jms.MessageConsumer")));
}
@Override
@@ -62,7 +61,7 @@ public final class JMS2MessageConsumerInstrumentation extends Instrumenter.Defau
@Override
public Map<ElementMatcher, String> transformers() {
- Map<ElementMatcher, String> transformers = new HashMap<>();
+ final Map<ElementMatcher, String> transformers = new HashMap<>();
transformers.put(
named("receive").and(takesArguments(0).or(takesArguments(1))).and(isPublic()),
ConsumerAdvice.class.getName());

MODIFY
dd-java-agent/instrumentation/jms-2/src/main/java/datadog/trace/instrumentation/jms2/JMS2MessageListenerInstrumentation.java
dd-java-agent/instrumentation/jms-2/src/main/java/datadog/trace/instrumentation/jms2/JMS2MessageListenerInstrumentation.java
@@ -3,7 +3,6 @@ package datadog.trace.instrumentation.jms2;
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
import static datadog.trace.instrumentation.jms.util.JmsUtil.toResourceName;
import static io.opentracing.log.Fields.ERROR_OBJECT;
-import static net.bytebuddy.matcher.ElementMatchers.failSafe;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
@@ -40,7 +39,7 @@ public final class JMS2MessageListenerInstrumentation extends Instrumenter.Defau
@Override
public ElementMatcher typeMatcher() {
- return not(isInterface()).and(failSafe(hasSuperType(named("javax.jms.MessageListener"))));
+ return not(isInterface()).and(hasSuperType(named("javax.jms.MessageListener")));
}
@Override
@@ -55,7 +54,7 @@ public final class JMS2MessageListenerInstrumentation extends Instrumenter.Defau
@Override
public Map<ElementMatcher, String> transformers() {
- Map<ElementMatcher, String> transformers = new HashMap<>();
+ final Map<ElementMatcher, String> transformers = new HashMap<>();
transformers.put(
named("onMessage").and(takesArgument(0, named("javax.jms.Message"))).and(isPublic()),
MessageListenerAdvice.class.getName());

MODIFY
dd-java-agent/instrumentation/jms-2/src/main/java/datadog/trace/instrumentation/jms2/JMS2MessageProducerInstrumentation.java
dd-java-agent/instrumentation/jms-2/src/main/java/datadog/trace/instrumentation/jms2/JMS2MessageProducerInstrumentation.java
@@ -3,7 +3,6 @@ package datadog.trace.instrumentation.jms2;
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
import static datadog.trace.instrumentation.jms.util.JmsUtil.toResourceName;
import static io.opentracing.log.Fields.ERROR_OBJECT;
-import static net.bytebuddy.matcher.ElementMatchers.failSafe;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
@@ -40,7 +39,7 @@ public final class JMS2MessageProducerInstrumentation extends Instrumenter.Defau
@Override
public ElementMatcher typeMatcher() {
- return not(isInterface()).and(failSafe(hasSuperType(named("javax.jms.MessageProducer"))));
+ return not(isInterface()).and(hasSuperType(named("javax.jms.MessageProducer")));
}
@Override
@@ -55,7 +54,7 @@ public final class JMS2MessageProducerInstrumentation extends Instrumenter.Defau
@Override
public Map<ElementMatcher, String> transformers() {
- Map<ElementMatcher, String> transformers = new HashMap<>();
+ final Map<ElementMatcher, String> transformers = new HashMap<>();
transformers.put(
named("send").and(takesArgument(0, named("javax.jms.Message"))).and(isPublic()),
ProducerAdvice.class.getName());

MODIFY
dd-java-agent/instrumentation/servlet-2/src/main/java/datadog/trace/instrumentation/servlet2/FilterChain2Instrumentation.java
dd-java-agent/instrumentation/servlet-2/src/main/java/datadog/trace/instrumentation/servlet2/FilterChain2Instrumentation.java
package datadog.trace.instrumentation.servlet2;
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
-import static net.bytebuddy.matcher.ElementMatchers.failSafe;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
@@ -24,7 +23,7 @@ public final class FilterChain2Instrumentation extends Instrumenter.Default {
@Override
public ElementMatcher typeMatcher() {
- return not(isInterface()).and(failSafe(hasSuperType(named("javax.servlet.FilterChain"))));
+ return not(isInterface()).and(hasSuperType(named("javax.servlet.FilterChain")));
}
@Override

MODIFY
dd-java-agent/instrumentation/servlet-2/src/main/java/datadog/trace/instrumentation/servlet2/HttpServlet2Instrumentation.java
dd-java-agent/instrumentation/servlet-2/src/main/java/datadog/trace/instrumentation/servlet2/HttpServlet2Instrumentation.java
package datadog.trace.instrumentation.servlet2;
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
-import static net.bytebuddy.matcher.ElementMatchers.failSafe;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
import static net.bytebuddy.matcher.ElementMatchers.isProtected;
@@ -29,7 +28,7 @@ public final class HttpServlet2Instrumentation extends Instrumenter.Default {
@Override
public ElementMatcher typeMatcher() {
- return not(isInterface()).and(failSafe(hasSuperType(named("javax.servlet.http.HttpServlet"))));
+ return not(isInterface()).and(hasSuperType(named("javax.servlet.http.HttpServlet")));
}
@Override

MODIFY
dd-java-agent/instrumentation/servlet-3/src/main/java/datadog/trace/instrumentation/servlet3/AbstractServlet3Instrumentation.java
dd-java-agent/instrumentation/servlet-3/src/main/java/datadog/trace/instrumentation/servlet3/AbstractServlet3Instrumentation.java
package datadog.trace.instrumentation.servlet3;
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
-import static net.bytebuddy.matcher.ElementMatchers.failSafe;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
@@ -22,7 +21,7 @@ public class AbstractServlet3Instrumentation extends Instrumenter.Default {
@Override
public ElementMatcher typeMatcher() {
- return not(isInterface()).and(failSafe(hasSuperType(named("javax.servlet.FilterChain"))));
+ return not(isInterface()).and(hasSuperType(named("javax.servlet.FilterChain")));
}
@Override

MODIFY
dd-java-agent/instrumentation/servlet-3/src/main/java/datadog/trace/instrumentation/servlet3/FilterChain3Instrumentation.java
dd-java-agent/instrumentation/servlet-3/src/main/java/datadog/trace/instrumentation/servlet3/FilterChain3Instrumentation.java
package datadog.trace.instrumentation.servlet3;
-import static net.bytebuddy.matcher.ElementMatchers.failSafe;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
@@ -19,7 +18,7 @@ public final class FilterChain3Instrumentation extends AbstractServlet3Instrumen
@Override
public ElementMatcher typeMatcher() {
- return not(isInterface()).and(failSafe(hasSuperType(named("javax.servlet.FilterChain"))));
+ return not(isInterface()).and(hasSuperType(named("javax.servlet.FilterChain")));
}
@Override

MODIFY
dd-java-agent/instrumentation/servlet-3/src/main/java/datadog/trace/instrumentation/servlet3/HttpServlet3Instrumentation.java
dd-java-agent/instrumentation/servlet-3/src/main/java/datadog/trace/instrumentation/servlet3/HttpServlet3Instrumentation.java
package datadog.trace.instrumentation.servlet3;
-import static net.bytebuddy.matcher.ElementMatchers.failSafe;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
import static net.bytebuddy.matcher.ElementMatchers.isProtected;
@@ -19,7 +18,7 @@ public final class HttpServlet3Instrumentation extends AbstractServlet3Instrumen
@Override
public ElementMatcher typeMatcher() {
- return not(isInterface()).and(failSafe(hasSuperType(named("javax.servlet.http.HttpServlet"))));
+ return not(isInterface()).and(hasSuperType(named("javax.servlet.http.HttpServlet")));
}
@Override

MODIFY
dd-java-agent/instrumentation/spring-web/src/main/java/datadog/trace/instrumentation/springweb/SpringWebInstrumentation.java
dd-java-agent/instrumentation/spring-web/src/main/java/datadog/trace/instrumentation/springweb/SpringWebInstrumentation.java
@@ -2,7 +2,6 @@ package datadog.trace.instrumentation.springweb;
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClassWithField;
import static io.opentracing.log.Fields.ERROR_OBJECT;
-import static net.bytebuddy.matcher.ElementMatchers.failSafe;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
@@ -39,7 +38,7 @@ public final class SpringWebInstrumentation extends Instrumenter.Default {
@Override
public ElementMatcher typeMatcher() {
return not(isInterface())
- .and(failSafe(hasSuperType(named("org.springframework.web.servlet.HandlerAdapter"))));
+ .and(hasSuperType(named("org.springframework.web.servlet.HandlerAdapter")));
}
@Override
@@ -50,7 +49,7 @@ public final class SpringWebInstrumentation extends Instrumenter.Default {
@Override
public Map<ElementMatcher, String> transformers() {
- Map<ElementMatcher, String> transformers = new HashMap<>();
+ final Map<ElementMatcher, String> transformers = new HashMap<>();
transformers.put(
isMethod()
.and(isPublic())
@@ -74,7 +73,7 @@ public final class SpringWebInstrumentation extends Instrumenter.Default {
@Override
public Map<ElementMatcher, String> transformers() {
- Map<ElementMatcher, String> transformers = new HashMap<>();
+ final Map<ElementMatcher, String> transformers = new HashMap<>();
transformers.put(
isMethod()
.and(isProtected())

Stop using `failSafe` matcher

It should not be necessary after we jave fixed class location issue
for ByteBuddy