Remove old checks from HelperInjector
They are not really producing anything useful anf they depend on API
that is forbidden in Java9+
MODIFY
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/HelperInjector.java
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/HelperInjector.java
@@ -65,17 +65,6 @@ public class HelperInjector implements Transformer {
if (!injectedClassLoaders.contains(classLoader)) {
try {
final Map<TypeDescription, byte[]> helperMap = getHelperMap();
- final Set<String> existingClasses = new HashSet<>();
- final ClassLoader systemCL = ClassLoader.getSystemClassLoader();
- if (classLoader != BOOTSTRAP_CLASSLOADER && !classLoader.equals(systemCL)) {
- // Build a list of existing helper classes.
- for (final TypeDescription def : helperMap.keySet()) {
- final String name = def.getName();
- if (Utils.isClassLoaded(name, systemCL)) {
- existingClasses.add(name);
- }
- }
- }
log.debug("Injecting classes onto classloader {} -> {}", classLoader, helperClassNames);
if (classLoader == BOOTSTRAP_CLASSLOADER) {
final Map<TypeDescription, Class<?>> injected =
@@ -90,16 +79,6 @@ public class HelperInjector implements Transformer {
} else {
new ClassInjector.UsingReflection(classLoader).inject(helperMap);
}
- if (classLoader != BOOTSTRAP_CLASSLOADER && !classLoader.equals(systemCL)) {
- for (final TypeDescription def : helperMap.keySet()) {
- // Ensure we didn't add any helper classes to the system CL.
- final String name = def.getName();
- if (!existingClasses.contains(name) && Utils.isClassLoaded(name, systemCL)) {
- throw new IllegalStateException(
- "Class was erroneously loaded on the System classloader: " + name);
- }
- }
- }
} catch (final Exception e) {
log.error(
"Error preparing helpers for "

Remove old checks from HelperInjector

They are not really producing anything useful anf they depend on API
that is forbidden in Java9+