Fix namespace clashes
Using `datadog.trace.agent` to hold agent class causes problems due to
shadowing into this package of other classes.
RENAME
dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/agent/Agent.java
dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java
-package datadog.trace.agent;
+package datadog.trace.bootstrap;
import java.lang.instrument.Instrumentation;
import java.lang.reflect.Constructor;

MODIFY
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/Constants.java
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/Constants.java
@@ -15,7 +15,6 @@ public final class Constants {
*/
public static final String[] BOOTSTRAP_PACKAGE_PREFIXES = {
"datadog.slf4j",
- "datadog.trace.agent",
"datadog.trace.api",
"datadog.trace.bootstrap",
"datadog.trace.context",

MODIFY
dd-java-agent/instrumentation/osgi-classloading/src/test/groovy/OSGIClassloadingTest.groovy
dd-java-agent/instrumentation/osgi-classloading/src/test/groovy/OSGIClassloadingTest.groovy
@@ -10,7 +10,7 @@ class OSGIClassloadingTest extends AgentTestRunner {
@Rule
public final RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties()
- static final String BOOT_DELEGATION_ADDITION = "datadog.slf4j.*,datadog.slf4j,datadog.trace.agent.*,datadog.trace.api.*,datadog.trace.api,datadog.trace.bootstrap.*,datadog.trace.bootstrap,datadog.trace.context.*,datadog.trace.context,datadog.trace.instrumentation.api.*,datadog.trace.instrumentation.api,io.opentracing.*,io.opentracing"
+ static final String BOOT_DELEGATION_ADDITION = "datadog.slf4j.*,datadog.slf4j,datadog.trace.api.*,datadog.trace.api,datadog.trace.bootstrap.*,datadog.trace.bootstrap,datadog.trace.context.*,datadog.trace.context,datadog.trace.instrumentation.api.*,datadog.trace.instrumentation.api,io.opentracing.*,io.opentracing"
def "delegation property set on module load"() {
when:

MODIFY
dd-java-agent/src/main/java/datadog/trace/agent/AgentBootstrap.java
dd-java-agent/src/main/java/datadog/trace/agent/AgentBootstrap.java
@@ -51,7 +51,7 @@ public class AgentBootstrap {
final URL bootstrapURL = installBootstrapJar(inst);
final Class<?> agentClass =
- ClassLoader.getSystemClassLoader().loadClass("datadog.trace.agent.Agent");
+ ClassLoader.getSystemClassLoader().loadClass("datadog.trace.bootstrap.Agent");
final Method startMethod = agentClass.getMethod("start", Instrumentation.class, URL.class);
startMethod.invoke(null, inst, bootstrapURL);
}

MODIFY
dd-java-agent/src/test/java/datadog/trace/agent/test/IntegrationTestUtils.java
dd-java-agent/src/test/java/datadog/trace/agent/test/IntegrationTestUtils.java
@@ -40,7 +40,7 @@ public class IntegrationTestUtils {
Field classloaderField = null;
try {
final Class<?> agentClass =
- ClassLoader.getSystemClassLoader().loadClass("datadog.trace.agent.Agent");
+ ClassLoader.getSystemClassLoader().loadClass("datadog.trace.bootstrap.Agent");
classloaderField = agentClass.getDeclaredField(fieldName);
classloaderField.setAccessible(true);
return (ClassLoader) classloaderField.get(null);

MODIFY
dd-java-agent/src/test/java/jvmbootstraptest/AgentLoadedChecker.java
dd-java-agent/src/test/java/jvmbootstraptest/AgentLoadedChecker.java
@@ -7,7 +7,7 @@ public class AgentLoadedChecker {
public static void main(final String[] args) throws ClassNotFoundException {
// Empty classloader that delegates to bootstrap
final URLClassLoader emptyClassLoader = new URLClassLoader(new URL[] {}, null);
- final Class agentClass = emptyClassLoader.loadClass("datadog.trace.agent.Agent");
+ final Class agentClass = emptyClassLoader.loadClass("datadog.trace.bootstrap.Agent");
if (agentClass.getClassLoader() != null) {
throw new RuntimeException(

MODIFY
dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/SpockRunner.java
dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/SpockRunner.java
@@ -32,7 +32,6 @@ public class SpockRunner extends Sputnik {
*/
public static final String[] BOOTSTRAP_PACKAGE_PREFIXES_COPY = {
"datadog.slf4j",
- "datadog.trace.agent",
"datadog.trace.api",
"datadog.trace.bootstrap",
"datadog.trace.context",

Fix namespace clashes

Using `datadog.trace.agent` to hold agent class causes problems due to
shadowing into this package of other classes.