mockkStatic leads to "Illegal reflective access" warning
See original GitHub issuePrerequisites
Please answer the following questions for yourself before submitting an issue.
- I am running the latest version
- I checked the documentation and found no answer
- I checked to make sure that this issue has not already been filed
Expected Behavior
No Warning when using mockStatic function
Steps to Reproduce
@Test
fun `mockkStatic generates a warning`() {
mockkStatic(LocalDate::class)
every { LocalDate.now() } returns LocalDate.parse("2021-04-16")
Assertions.assertEquals(16, LocalDate.now().dayOfMonth)
}
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
- MockK version: 1.11.0
- Kotlin version: 1.4.10
- JDK version: 11
- JUnit version: 1.5
- Type of test: unit test
Failure Logs
[Test worker] DEBUG io.mockk.impl.recording.states.AnsweringState - Answering 2021-04-16 on class java.time.LocalDate.now() WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by io.mockk.proxy.jvm.advice.MethodCall (file:/home/wjhf5963/.gradle/caches/modules-2/files-2.1/io.mockk/mockk-agent-jvm/1.11.0/424bbf69d819f115f8f5df9e7a897f680a483310/mockk-agent-jvm-1.11.0.jar) to method java.time.LocalDate.create(int,int,int) WARNING: Please consider reporting this to the maintainers of io.mockk.proxy.jvm.advice.MethodCall 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
Issue Analytics
- State:
- Created 2 years ago
- Reactions:11
- Comments:13 (1 by maintainers)
Top GitHub Comments
+1. I’m experiencing the exact same issue and I am also not using roboelectric or android.
I don’t have bandwidth to work on this now, but I’d gladly review a PR about it.