AsgcCompiler代码优化.
This commit is contained in:
@@ -69,7 +69,7 @@ public class AsgcCompiler {
|
||||
this.standardJavaFileManager = javaCompiler.getStandardFileManager(collector, null, null);
|
||||
this.isSaveClassFile = false;
|
||||
this.generatorCodeSavePath = GlobalConfig.getGeneratorCodeSavePath();
|
||||
this.dynamicClassLoader = new DynamicClassLoader(this, classLoader);
|
||||
this.dynamicClassLoader = new DynamicClassLoader(classLoader, this);
|
||||
|
||||
addOption("-Xlint:unchecked");
|
||||
addOption("-implicit:class");
|
||||
|
||||
+7
-9
@@ -40,7 +40,7 @@ public class DynamicClassLoader extends ClassLoader {
|
||||
super(classLoader);
|
||||
}
|
||||
|
||||
public DynamicClassLoader(AsgcCompiler compiler, ClassLoader classLoader) {
|
||||
public DynamicClassLoader(ClassLoader classLoader, AsgcCompiler compiler) {
|
||||
super(classLoader);
|
||||
this.compiler = compiler;
|
||||
}
|
||||
@@ -55,18 +55,16 @@ public class DynamicClassLoader extends ClassLoader {
|
||||
if (null != byteCode) {
|
||||
return super.defineClass(name, byteCode.getByteCode(), 0, byteCode.getByteCode().length);
|
||||
}
|
||||
Class<?> ret = doFindClass(name);
|
||||
if (null != ret) {
|
||||
return ret;
|
||||
if (null != this.compiler) {
|
||||
Class<?> ret = doFindClass(name, compiler.getClasspathList());
|
||||
if (null != ret) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return super.findClass(name);
|
||||
}
|
||||
|
||||
private Class<?> doFindClass(String name) throws ClassNotFoundException {
|
||||
if (null == compiler) {
|
||||
return null;
|
||||
}
|
||||
List<String> classpathList = compiler.getClasspathList();
|
||||
private Class<?> doFindClass(String name, List<String> classpathList) throws ClassNotFoundException {
|
||||
if (CollectionUtil.isEmpty(classpathList)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -32,54 +32,52 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- <build>-->
|
||||
<!-- <finalName>${artifactId}</finalName>-->
|
||||
<!-- <plugins>-->
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
|
||||
<!-- <version>2.1.3.RELEASE</version>-->
|
||||
<!-- <configuration>-->
|
||||
<!-- <executable>true</executable>-->
|
||||
<!-- <mainClass>fun.asgc.neutrino.proxy.server.ProxyServer</mainClass>-->
|
||||
<!-- <classifier>exec</classifier>-->
|
||||
<!-- </configuration>-->
|
||||
<!-- <executions>-->
|
||||
<!-- <execution>-->
|
||||
<!-- <goals>-->
|
||||
<!-- <goal>repackage</goal>-->
|
||||
<!-- </goals>-->
|
||||
<!-- </execution>-->
|
||||
<!-- </executions>-->
|
||||
<!-- </plugin>-->
|
||||
<!-- </plugins>-->
|
||||
<!-- </build>-->
|
||||
|
||||
<build>
|
||||
<finalName>${artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.1.3.RELEASE</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<!--这里指定要运行的main类-->
|
||||
<mainClass>fun.asgc.neutrino.proxy.server.ProxyServer</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<mainClass>fun.asgc.neutrino.proxy.server.ProxyServer</mainClass>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<!-- <build>-->
|
||||
<!-- <plugins>-->
|
||||
<!-- <plugin>-->
|
||||
<!-- <artifactId>maven-assembly-plugin</artifactId>-->
|
||||
<!-- <configuration>-->
|
||||
<!-- <archive>-->
|
||||
<!-- <manifest>-->
|
||||
<!-- <!–这里指定要运行的main类–>-->
|
||||
<!-- <mainClass>fun.asgc.neutrino.proxy.server.ProxyServer</mainClass>-->
|
||||
<!-- </manifest>-->
|
||||
<!-- </archive>-->
|
||||
<!-- <descriptorRefs>-->
|
||||
<!-- <descriptorRef>jar-with-dependencies</descriptorRef>-->
|
||||
<!-- </descriptorRefs>-->
|
||||
<!-- </configuration>-->
|
||||
<!-- <executions>-->
|
||||
<!-- <execution>-->
|
||||
<!-- <id>make-assembly</id>-->
|
||||
<!-- <phase>package</phase>-->
|
||||
<!-- <goals>-->
|
||||
<!-- <goal>single</goal>-->
|
||||
<!-- </goals>-->
|
||||
<!-- </execution>-->
|
||||
<!-- </executions>-->
|
||||
<!-- </plugin>-->
|
||||
<!-- </plugins>-->
|
||||
<!-- </build>-->
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user