Closed fanyawei closed 2 years ago
我也遇到了
JDK9 模块化引起的问题
JDK9 模块化引起的问题
但是使用JDK11都没问题啊
我也遇到了
请问你解决了吗
模块化的内容需要你们自己测试以下,JDK11 虽然在 Method 和 Field 中的 setAccessible 加入了检查:if (flag) checkCanSetAccessible(Reflection.getCallerClass());
,但模块是 open 的,因此没有错误。
在 JDK16 中这些模块默认不再是 open 了,因此可以预见,当你试图反射任何未开放给当前模块的非公共成员,都会有一个 java.lang.ExceptionInInitializerError
抛出。
上个修复方法之中,我们错误的认为会抛出一个 java.lang.reflect.InaccessibleObjectException
,因为不同版本之间的JDK测试存在一定难度,我们大意了。不过最近我们已经在昨天修复了这个问题,下次更新就会修复该问题。
也遇到了,不过常规的new QueryWrapper没有受到影响
降回老版本也能暂时避免问题,比如3.4.0
JDK11运行会提示反射的access警告,可以正常使用,并且提示下一版本将会denied反射机制。JDK16属于JDK11之后的版本,无法正常使用反射机制获取Entity中private成员。建议使用JDK1.8或11版本来和MyBatis进行搭配。
当前使用版本(必填,否则不予处理)
mybatis-plus:3.4.3.2 jdk:oraclejdk-16.0.2 springboot:2.5.4
该问题是如何引起的?(确定最新版也有问题再提!!!)
最新稳定版本3.4.3.2,启动时候不加指定参数,LambdaQueryWrapper条件查询还是报错
重现步骤(如果有就写完整)
pom.xml
实体
Mapper接口
junit
报错信息