diff --git a/CHANGELOG.MD b/CHANGELOG.MD index cc350fa..a41cbcb 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -10,6 +10,7 @@ - [功能] 添加对泛型 `signature` 的处理 - [优化] 优化 `builtin` 黑名单解析和注释 - [BUG] 修复没有添加目录到 `JAR ENTRY` 的问题 +- [BUG] 花指令混淆部分遇到类加载报错解决 - [BUG] 修复 `MANIFEST.MF` 没有完全修改的问题 感谢以下用户的贡献: diff --git a/src/main/java/me/n1ar4/jar/obfuscator/transform/JunkCodeTransformer.java b/src/main/java/me/n1ar4/jar/obfuscator/transform/JunkCodeTransformer.java index b6a0eba..41b2088 100644 --- a/src/main/java/me/n1ar4/jar/obfuscator/transform/JunkCodeTransformer.java +++ b/src/main/java/me/n1ar4/jar/obfuscator/transform/JunkCodeTransformer.java @@ -37,7 +37,14 @@ public static void transform(BaseConfig config) { ClassWriter classWriter = new CustomClassWriter(classReader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS, loader); JunkCodeChanger changer = new JunkCodeChanger(classWriter, config); - classReader.accept(changer, Const.AnalyzeASMOptions); + try { + classReader.accept(changer, Const.AnalyzeASMOptions); + } catch (Exception ignored) { + // CustomClassLoader 可能会找不到类 + // 这个地方目前做法是跳过这个类的花指令混淆 + logger.debug("花指令混淆使用自定义类加载器出现错误"); + continue; + } Files.delete(newClassPath); Files.write(newClassPath, classWriter.toByteArray()); } catch (MethodTooLargeException ex) {