Skip to content

Commit

Permalink
改端口
Browse files Browse the repository at this point in the history
  • Loading branch information
TangBean committed Feb 16, 2019
1 parent 30ef8f1 commit f2d4060
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/main/java/org/olexec/compile/StringSourceCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@

public class StringSourceCompiler {
private static Map<String, JavaFileObject> fileObjectMap = new ConcurrentHashMap<>();
// 使用 Pattern 预编译功能

/** 使用 Pattern 预编译功能 */
private static Pattern CLASS_PATTERN = Pattern.compile("class\\s+([$_a-zA-Z][$_a-zA-Z0-9]*)\\s*");

public static byte[] compile(String source, DiagnosticCollector<JavaFileObject> compileCollector) {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
JavaFileManager javaFileManager =
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/org/olexec/execute/ClassModifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ public int getConstantPoolCount() {
return ByteUtils.byte2Int(classByte, CONSTANT_POOL_COUNT_INDEX, u2);
}

/**
* 字节码修改器,替换字节码常量池中 oldStr 为 newStr
* @param oldStr
* @param newStr
* @return 修改后的字节码字节数组
*/
public byte[] modifyUTF8Constant(String oldStr, String newStr) {
int cpc = getConstantPoolCount();
int offset = CONSTANT_POOL_COUNT_INDEX + u2; // 真实的常量起始位置
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
spring.freemarker.suffix=.html
server.port=9090
spring.freemarker.suffix=.html

0 comments on commit f2d4060

Please sign in to comment.