-
Notifications
You must be signed in to change notification settings - Fork 31
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
@SpykBean on Spring Data Repository doesn't work anymore with JDK16+ #65
Comments
It doesn't seem to work on |
Sorry folks. To be honest, I have no idea of how to deal with this issue. My guess is that it's actually a problem of MockK itself regarding spying proxies. If one of you could come up with a simple repro (as a github repo), maybe not even using SpringMockK, and could sublit this issue to MockK, that would be great. |
Also met this issue while trying to update to JDK17. Are there any options to overcome this? I thought common to spy on repositories. I'm surprised that not that many people report that they have this problem. I don't see any relevant issue on mockk side. One option I see is not to spy on the repositories ;) But it's said nowhere in the documentation, that one shall not do that. |
@jnizet I agree that this is almost certainly a mockk issue with proxy spies. Another piece of information - for whatever reason the final exception masks the original exception:
So it appears the new Java 17 strong encapsulation is what is actually breaking this. In 9-11 this just gave a warning, now it fails hard. @ajgassner @PavelPolyakov a workaround is to add the tasks.test {
jvmArgs = listOf("--add-opens=java.base/java.lang.reflect=ALL-UNNAMED")
} Adding this for me causes my spied repositories to work just as before. My JVM:
|
Thanks a lot @phillipuniverse , that's good information! It would really be nice if you could open an issue, with a minimal repro, on the MockK repo, because it looks more and more like something that does not really come from SpringMockK. |
It seems to me, spring data is also involved in this issue. According to spring docs, |
Any further progress on this issue? I just updated to java 17 and run into the same errors. So its seem to be still an issue :( |
@MarianPohling The workaround explained above, and now described in the README, is the official solution from MockK |
Hi,
I already stumbled over @jnizet commit b6dbc1b
But in our case
@SpykBean
isn't working with following configuration:Simple data repository spy:
Exception when running the test:
The workaround is to switch to JDK <= 15.
Has anyone an idea to fix the issue?
The text was updated successfully, but these errors were encountered: