F2-13: 修编译目标降 release=21 + 升 Groovy 4.0.27 + .groovy 转 Java(修报表 500)

根因:JDK26 编译产生 major version 70 字节码,Groovy 4.0.24 内嵌 ASM 不支持,
导致报表取数链路语义分析崩溃。
修法:
1. pom.xml 将 source/target=17 改为 maven.compiler.release=21(真正约束输出字节码)
2. groovy-jsr223 版本升至 4.0.27(与本地 groovy core 4.0.27 配套)
3. SecureGroovyScriptEngineFactory/MethodCallExpressionChecker 从 .groovy 转写为
   .java,彻底移除 gmavenplus 插件,消除 JDK26 下 ASM generateStubs 崩溃

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 23:33:19 +08:00
parent 6dbb205e94
commit 6e9a39aa35
7 changed files with 189 additions and 205 deletions

View File

@@ -48,33 +48,7 @@
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency>
</dependencies>
<build>
<plugins>
<!-- P1 服务流引擎:framework 函数库 GetValueFunction/GetDefaultValueFunction 与
SecureGroovyScriptEngineFactory/MethodCallExpressionChecker 为 .groovy 源码
(原样移植,见 src/main/groovy),需 Groovy 联合编译为字节码,运行时脚本方可按
FQN import。gmavenplus 在 compile 阶段编译 src/main/groovy,与 javac 联合。 -->
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<goals>
<!-- generateStubs 在 javac 前产出 Java 桩,使 com.dsasp.* 的 .java
可引用 .groovy 类(GetValueFunction 等);compile 再产出真实字节码。 -->
<goal>addSources</goal>
<goal>addTestSources</goal>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>compileTests</goal>
<goal>removeStubs</goal>
<goal>removeTestStubs</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- F2-13: SecureGroovyScriptEngineFactory/MethodCallExpressionChecker 已从 .groovy 转写为
.java(见 src/main/java/.../secure/),彻底消除 gmavenplus 在 JDK26 下的 ASM 兼容性问题。
gmavenplus plugin 已移除,无需 Groovy 联合编译。 -->
</project>