Remove old checks from HelperInjector

They are not really producing anything useful anf they depend on API
that is forbidden in Java9+
This commit is contained in:
Nikolay Martynov 2018-07-26 10:11:24 -04:00
parent 44b364332a
commit 0f80f7dd40
1 changed files with 0 additions and 21 deletions

View File

@ -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 "