Upgrade Byte Buddy to 1.9.0
MODIFY
.circleci/config.yml
.circleci/config.yml
@@ -182,7 +182,6 @@ jobs:
# Reset the cache approx every release
keys:
- dd-trace-java-version-scan-{{ checksum "dd-trace-java.gradle" }}
- - dd-trace-java-version-scan
- run:
name: Verify Version Scan and Muzzle

MODIFY
buildSrc/build.gradle
buildSrc/build.gradle
@@ -13,5 +13,6 @@ dependencies {
compile group: 'org.apache.maven', name: 'maven-aether-provider', version: '3.3.9'
compile group: 'com.google.guava', name: 'guava', version: '20.0'
- compile group: 'org.ow2.asm', name: 'asm-all', version: '5.2'
+ compile group: 'org.ow2.asm', name: 'asm', version: '7.0-beta'
+ compile group: 'org.ow2.asm', name: 'asm-tree', version: '7.0-beta'
}

MODIFY
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/DDCachingPoolStrategy.java
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/DDCachingPoolStrategy.java
@@ -90,7 +90,7 @@ public class DDCachingPoolStrategy implements PoolStrategy {
cache.invalidateAll();
}
- private class ResolutionProvider implements Callable<TypePool.Resolution> {
+ private static class ResolutionProvider implements Callable<TypePool.Resolution> {
private final TypePool.Resolution value;
private ResolutionProvider(final TypePool.Resolution value) {

MODIFY
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/Instrumenter.java
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/Instrumenter.java
@@ -96,7 +96,7 @@ public interface Instrumenter {
.transform(DDTransformers.defaultTransformers());
agentBuilder = injectHelperClasses(agentBuilder);
agentBuilder = applyInstrumentationTransformers(agentBuilder);
- return agentBuilder.asDecorator();
+ return agentBuilder;
}
private AgentBuilder.Identified.Extendable injectHelperClasses(

MODIFY
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/Utils.java
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/Utils.java
@@ -31,7 +31,9 @@ public class Utils {
// jackson
"org.msgpack",
"com.fasterxml.jackson",
- "org.yaml.snakeyaml"
+ "org.yaml.snakeyaml",
+ // modules
+ "module-info",
};
private static Method findLoadedClassMethod = null;

MODIFY
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/muzzle/MuzzleGradlePlugin.java
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/muzzle/MuzzleGradlePlugin.java
package datadog.trace.agent.tooling.muzzle;
import datadog.trace.agent.tooling.Instrumenter;
+import java.io.IOException;
import net.bytebuddy.build.Plugin;
import net.bytebuddy.description.type.TypeDefinition;
import net.bytebuddy.description.type.TypeDescription;
+import net.bytebuddy.dynamic.ClassFileLocator;
import net.bytebuddy.dynamic.DynamicType.Builder;
/** Bytebuddy gradle plugin which creates muzzle-references at compile time. */
@@ -30,10 +32,16 @@ public class MuzzleGradlePlugin implements Plugin {
}
@Override
- public Builder<?> apply(final Builder<?> builder, final TypeDescription typeDescription) {
+ public Builder<?> apply(
+ final Builder<?> builder,
+ final TypeDescription typeDescription,
+ final ClassFileLocator classFileLocator) {
return builder.visit(new MuzzleVisitor());
}
+ @Override
+ public void close() throws IOException {}
+
/** Compile-time Optimization used by gradle buildscripts. */
public static class NoOp implements Plugin {
@Override
@@ -42,8 +50,14 @@ public class MuzzleGradlePlugin implements Plugin {
}
@Override
- public Builder<?> apply(final Builder<?> builder, final TypeDescription typeDescription) {
+ public Builder<?> apply(
+ final Builder<?> builder,
+ final TypeDescription typeDescription,
+ final ClassFileLocator classFileLocator) {
return builder;
}
+
+ @Override
+ public void close() throws IOException {}
}
}

MODIFY
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/muzzle/MuzzleVisitor.java
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/muzzle/MuzzleVisitor.java
@@ -54,7 +54,7 @@ public class MuzzleVisitor implements AsmVisitorWrapper {
private Instrumenter.Default instrumenter;
public InsertSafetyMatcher(ClassVisitor classVisitor) {
- super(Opcodes.ASM6, classVisitor);
+ super(Opcodes.ASM7, classVisitor);
}
@Override
@@ -461,7 +461,7 @@ public class MuzzleVisitor implements AsmVisitorWrapper {
/** Append a field initializer to the end of a method. */
public class InitializeFieldVisitor extends MethodVisitor {
public InitializeFieldVisitor(MethodVisitor methodVisitor) {
- super(Opcodes.ASM6, methodVisitor);
+ super(Opcodes.ASM7, methodVisitor);
}
@Override

MODIFY
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/muzzle/ReferenceCreator.java
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/muzzle/ReferenceCreator.java
@@ -169,7 +169,7 @@ public class ReferenceCreator extends ClassVisitor {
private boolean createFromMethodBodiesOnly;
private ReferenceCreator(ClassVisitor classVisitor, boolean createFromMethodBodiesOnly) {
- super(Opcodes.ASM6, classVisitor);
+ super(Opcodes.ASM7, classVisitor);
this.createFromMethodBodiesOnly = createFromMethodBodiesOnly;
}
@@ -229,7 +229,7 @@ public class ReferenceCreator extends ClassVisitor {
private int currentLineNumber = -1;
public AdviceReferenceMethodVisitor(MethodVisitor methodVisitor) {
- super(Opcodes.ASM6, methodVisitor);
+ super(Opcodes.ASM7, methodVisitor);
}
@Override

MODIFY
dd-java-agent/agent-tooling/src/test/groovy/datadog/trace/agent/test/ExceptionHandlerTest.groovy
dd-java-agent/agent-tooling/src/test/groovy/datadog/trace/agent/test/ExceptionHandlerTest.groovy
@@ -38,7 +38,6 @@ class ExceptionHandlerTest extends Specification {
.advice(
isMethod().and(named("smallStack").or(named("largeStack"))),
BadAdvice.NoOpAdvice.getName()))
- .asDecorator()
ByteBuddyAgent.install()
builder.installOn(ByteBuddyAgent.getInstrumentation())

MODIFY
gradle/dependencies.gradle
gradle/dependencies.gradle
@@ -15,7 +15,7 @@ ext {
junit : "4.12",
logback : "1.2.3",
lombok : "1.18.0",
- bytebuddy : "1.8.14",
+ bytebuddy : "1.9.0",
]
deps = [

Upgrade Byte Buddy to 1.9.0