Remove Bytecode Compatibility Transformer (#5526)

* Remove Bytecode Compatibility Transformer

* AntClassLoader2 is now redundant

Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>
This commit is contained in:
Basil CrowandTim Jacomb authored and GitHub committed 2021-06-01 13:06:30 +08:00
1 parent 972c6fa51a
commit 2760e3ebfb
6 files changed
+1 -55

No files matched your search

@@ -52,10 +52,8 @@ import org.apache.tools.ant.util.GlobPatternMapper;
import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipExtraField;
import org.apache.tools.zip.ZipOutputStream;
import org.jenkinsci.bytecode.Transformer;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.io.Closeable;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FilenameFilter;
@@ -304,7 +302,7 @@ public class ClassicPluginStrategy implements PluginStrategy {
}
}
AntClassLoader2 classLoader = new AntClassLoader2(parent);
AntWithFindResourceClassLoader classLoader = new AntWithFindResourceClassLoader(parent, true);
classLoader.addPathFiles(paths);
return classLoader;
}
@@ -708,25 +706,7 @@ public class ClassicPluginStrategy implements PluginStrategy {
}
}
/**
* {@link AntClassLoader} with a few methods exposed, {@link Closeable} support, and {@link Transformer} support.
*/
private final class AntClassLoader2 extends AntWithFindResourceClassLoader implements Closeable {
private AntClassLoader2(ClassLoader parent) {
super(parent, true);
}
@Override
protected Class defineClassFromData(File container, byte[] classData, String classname) throws IOException {
if (!DISABLE_TRANSFORMER)
classData = pluginManager.getCompatibilityTransformer().transform(classname, classData, this);
return super.defineClassFromData(container, classData, classname);
}
}
/* Unused since 1.527, see https://github.com/jenkinsci/jenkins/commit/47de54d070f67af95b4fefb6d006a72bb31a5cb8 */
@Deprecated
public static boolean useAntClassLoader = SystemProperties.getBoolean(ClassicPluginStrategy.class.getName()+".useAntClassLoader");
@SuppressFBWarnings("MS_SHOULD_BE_FINAL")
public static boolean DISABLE_TRANSFORMER = SystemProperties.getBoolean(ClassicPluginStrategy.class.getName()+".noBytecodeTransformer");
}