-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MyBatis and JDK 9: Illegal reflective access #1156
Comments
Thanks for your reporting! |
As a side effect, this might reduce the chance of 'illegal reflective access' warnings on Java 9. #1156
This issue has been fixed via 3.4.6 (#1180). |
With 3.4.6 I'm still getting a "reflective" error but just on a different method: WARNING: An illegal reflective access operation has occurred |
@jgprospect thanks for your reaction! This issue keeps the open status. |
I think the fix in #1180 should be rolled-back, since it doesn't address the root cause. Check the following stacktraces (obtained by running the JVM with "--illegal-access=debug"):
As you can see, the error doesn't have anything to do with java.lang.Object. I suspect the code looks-up fields and getter/setters for mappings, but maybe it shouldn't look up private fields and getters/setters at all. If this is not possible to completely remove mapping of non-public fields/methods (for backward compatibility reasons), add a configuration option to turn off such mapping (with the default to allow - to preserve backwards compatibility). |
BTW, I the only places for this problem seem to be in At least in my code, I couldn't find any other place. |
Hi @cristian-mocanu-mob , Please read the comments on #1180 . |
I think the additional property suggested by @cristian-mocanu-mob is a good solution. JDK11 will be released soon and it will be LTS so a lot of people will migrate to this version. It would be good to have this option already. |
I am still doing my research, but simple ON/OFF switch may be insufficient. I think the right fix would be to check if a field/method is accessible only when it's requested by user's code (e.g. the field/property is referenced from a mapper). |
Hi all, |
I assume all is working well. :) |
Using OpenJDK 11 with |
3.5.1 with JDK11.0.2 ,still has this waining: WARNING: An illegal reflective access operation has occurred |
3.5.2 with openjdk version "11.0.4" 2019-07-16 |
Yep, confirmed! (that it is fixed) |
WARNING: An illegal reflective access operation has occurred |
the warning still exists in 3.5.7 (with mybatis-plu 3.4.3.1)
|
@ldwnt , I'm going to lock this issue. |
After updating from JDK 8 to JDK 9, I'm getting following warnings:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.ibatis.reflection.Reflector (file:/C:/Java%20Libs/MyBatis/mybatis-3.4.5.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.apache.ibatis.reflection.Reflector
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
This happens because of new modular arch of JDK 9.
The text was updated successfully, but these errors were encountered: