From a57cfc372fd07d25a6b767152c077b2b2289622b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=94=E6=B0=91=E5=B0=8F=E9=95=87?= <262610965@qq.com> Date: Sun, 31 Mar 2024 12:58:50 +0800 Subject: [PATCH] fix #211 jar error.evn:java21,springBoot3.2. --- .../bjf/remoting/protobuf/utils/compiler/JdkCompiler.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/baidu/bjf/remoting/protobuf/utils/compiler/JdkCompiler.java b/src/main/java/com/baidu/bjf/remoting/protobuf/utils/compiler/JdkCompiler.java index d00d426..956e72a 100644 --- a/src/main/java/com/baidu/bjf/remoting/protobuf/utils/compiler/JdkCompiler.java +++ b/src/main/java/com/baidu/bjf/remoting/protobuf/utils/compiler/JdkCompiler.java @@ -127,6 +127,7 @@ public JdkCompiler(final ClassLoader loader, final String jdkVersion) { if (loader instanceof URLClassLoader && (!loader.getClass().getName().equals("sun.misc.Launcher$AppClassLoader"))) { try { + boolean isJava21 = "21".equals(System.getProperty("java.specification.version")); URLClassLoader urlClassLoader = (URLClassLoader) loader; List files = new ArrayList(); boolean isInternalJar = false; @@ -143,6 +144,11 @@ public JdkCompiler(final ClassLoader loader, final String jdkVersion) { file = StringUtils.removeStart(file, "file:"); } + if (isJava21 && file.startsWith("nested:")) { + // springBoot 3.2 + file = StringUtils.removeStart(file, "nested:"); + } + if (file.indexOf("!") != -1) { // if has internal jar like // file:/D:/develop/a.jar!/BOOT-INF/lib/spring-boot-starter-1.5.14.RELEASE.jar