build: 删除无用的类
This commit is contained in:
parent
d57484f57f
commit
5e4da87359
|
@ -13,7 +13,6 @@ import javax.script.ScriptEngineManager;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLClassLoader;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
package io.metersphere.config;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.net.URLClassLoader;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public class OpenUrlClassLoaderModule {
|
|
||||||
|
|
||||||
static {
|
|
||||||
// If on Java 9+, open the URLClassLoader module to this module
|
|
||||||
// so we can access its API via reflection without producing a warning.
|
|
||||||
try {
|
|
||||||
openUrlClassLoaderModule();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
// ignore exception - will throw on Java 8 since the Module classes don't exist
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void openUrlClassLoaderModule() throws Exception {
|
|
||||||
// This is effectively calling:
|
|
||||||
//
|
|
||||||
// URLClassLoader.class.getModule().addOpens(
|
|
||||||
// URLClassLoader.class.getPackageName(),
|
|
||||||
// ReflectionClassLoader.class.getModule()
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// We use reflection since we build against Java 8.
|
|
||||||
|
|
||||||
Class<?> moduleClass = Class.forName("java.lang.Module");
|
|
||||||
Method getModuleMethod = Class.class.getMethod("getModule");
|
|
||||||
Method addOpensMethod = moduleClass.getMethod("addOpens", String.class, moduleClass);
|
|
||||||
|
|
||||||
Object urlClassLoaderModule = getModuleMethod.invoke(URLClassLoader.class);
|
|
||||||
Object thisModule = getModuleMethod.invoke(OpenUrlClassLoaderModule.class);
|
|
||||||
|
|
||||||
addOpensMethod.invoke(urlClassLoaderModule, URLClassLoader.class.getPackage().getName(), thisModule);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue