From ccc316ee8c521c579e0357dfbd4f972a1384da26 Mon Sep 17 00:00:00 2001 From: Looly Date: Fri, 3 Mar 2023 20:43:42 +0800 Subject: [PATCH] JavaSourceCompilerTest --- CHANGELOG.md | 1 + .../java/cn/hutool/core/compiler/JavaSourceCompilerTest.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f7192ea7..ce7131d4e 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ * 【core 】 修复ReflectUtil.invokeRaw方法中参数类型转换动作未生效的问题(pr#2912@Github) * 【core 】 修复isXXX转换时的匹配问题(issue#I6H0XF@Gitee) * 【core 】 修复MutableObj.equals空指针问题 +* 【core 】 修复JavaSourceFileObject在编译错误时抛出IOException异常而非CompilerException问题(pr#2942@Github) ------------------------------------------------------------------------------------------------------------- diff --git a/hutool-core/src/test/java/cn/hutool/core/compiler/JavaSourceCompilerTest.java b/hutool-core/src/test/java/cn/hutool/core/compiler/JavaSourceCompilerTest.java index b62d72a1c..71c5cc129 100644 --- a/hutool-core/src/test/java/cn/hutool/core/compiler/JavaSourceCompilerTest.java +++ b/hutool-core/src/test/java/cn/hutool/core/compiler/JavaSourceCompilerTest.java @@ -36,7 +36,7 @@ public class JavaSourceCompilerTest { // .addLibrary(FileUtil.file("D:\\m2_repo\\cn\\hutool\\hutool-all\\5.5.7\\hutool-all-5.5.7.jar")) .compile(); final Class clazz = classLoader.loadClass("c.C"); - Object obj = ReflectUtil.newInstance(clazz); + final Object obj = ReflectUtil.newInstance(clazz); Assert.assertTrue(String.valueOf(obj).startsWith("c.C@")); } @@ -47,7 +47,7 @@ public class JavaSourceCompilerTest { CompilerUtil.getCompiler(null) .addSource(FileUtil.file("test-compile/error/ErrorClazz.java")) .compile(); - } catch (Exception ex) { + } catch (final Exception ex) { exception = ex; } finally { Assert.assertTrue(exception instanceof CompilerException);