Javassist编译导致类文件损坏
我试图在编译时使用javassist插入一些代码片段 环境Javassist编译导致类文件损坏,java,spring-boot,javassist,Java,Spring Boot,Javassist,我试图在编译时使用javassist插入一些代码片段 环境 爪哇8 弹簧靴2.2.6 冬眠5.4.12.1决赛 Javassist 我得到的编译错误出现在testCompile步骤: [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ---------------------------------------------------
- 爪哇8
- 弹簧靴2.2.6
- 冬眠5.4.12.1决赛
- Javassist
testCompile
步骤:
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] [PATH]/EPAServiceTest.java:[17,44] cannot access [PACKAGE].EP
bad class file: [PATH]/EP.class
bad constant pool entry in RegularFileObject[[PATH]/EP.class]
expected CONSTANT_Utf8_info or CONSTANT_String_info at index 212
Please remove or make sure it appears in the correct subdirectory of the classpath.
[ERROR] [PATH]/EPAServiceTest.java:[6,1] cannot find symbol
symbol: static makeDTO
location: class
[INFO] 2 errors
[INFO] -------------------------------------------------------------
当错误显示无法访问文件时,EP.class
内容如下:
// IntelliJ API Decompiler stub source generated from a class file
// Implementation of methods is not available
package corrupted_class_files;
在大量搜索之后,我发现插件使用的
javassist
版本是3.18.0-GA
,与hibernate5.14.12的版本不匹配
因此,我已经将插件javassist
依赖项覆盖到版本3.24.0-GA
,该版本通过了编译步骤
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.24.0-GA</version>
</dependency>
org.javassist
javassist
3.24.0-GA
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] [PATH]/EPAServiceTest.java:[17,44] cannot access [PACKAGE].EP
bad class file: [PATH]/EP.class
bad constant pool entry in RegularFileObject[[PATH]/EP.class]
expected CONSTANT_Utf8_info or CONSTANT_String_info at index 212
Please remove or make sure it appears in the correct subdirectory of the classpath.
[ERROR] [PATH]/EPAServiceTest.java:[6,1] cannot find symbol
symbol: static makeDTO
location: class
[INFO] 2 errors
[INFO] -------------------------------------------------------------
// IntelliJ API Decompiler stub source generated from a class file
// Implementation of methods is not available
package corrupted_class_files;
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.24.0-GA</version>
</dependency>