-
-
Notifications
You must be signed in to change notification settings - Fork 332
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
Bug: StackOverflowError in case of complex annotation checks involving HashMap calls #337
Comments
Ok, so i did some research and tried out some stuff. Turns out it is because of the installed JDK. I used I then tried out some configurations and came up with following list: AdoptOpenJDK: 1.8.0_212 openJ9 -> FAIL Overall the hotspot variants are working. I leave it up to Mockk team whether you want to look into supporting openJ9. I switched to hotspot for now. So long, Felix |
Thank you for your investigation |
Hi, I also facing the same issue when mocking Spring beans by @MockkBean (springmockk). |
Its failing for me using 1.8.0_221-b11 hotspot. |
I also have this same issue. I have found that I can use AdoptOpenJDK 8 u202 b08 OpenJ9 and it works fine. |
I hit the bug as well in one of my demo projects. The tests fail with a stack overflow if OpenJ9 is used. The failure is reproducible in both JDK12 and JDK8. |
A more extensive test shows failures on OpenJ9 11 as well. |
Is there any plan to fix this ? I have this same issue with OpenJ9 13 |
This will get merged once mockk/mockk#337 is fixed.
This will get merged once mockk/mockk#337 is fixed.
Just so you know eclipse-openj9/openj9#9940 seems to be the same issue. |
Is there any hypothesis on why this happens, any workaround? |
My current theory is that it's due to the jacoco agent modifying the A potential workaround is to not instrument Object using jacoco by adding |
This will get merged once mockk/mockk#337 is fixed.
This is unrelated to Jacoco, this is the minimal reproduction case I could come up with:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
}
}
repositories {
mavenCentral()
}
apply plugin: "kotlin"
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72"
testImplementation "junit:junit:4.13"
testImplementation "io.mockk:mockk:1.10.0"
}
internal class Example
import io.mockk.mockk
import org.junit.Test
class ExampleTest {
@Test
fun test() {
mockk<Example>(relaxed = true)
}
}
|
This will get merged once mockk/mockk#337 is fixed.
This will get merged once mockk/mockk#337 is fixed.
This will get merged once mockk/mockk#337 is fixed.
This will get merged once mockk/mockk#337 is fixed.
This will get merged once mockk/mockk#337 is fixed.
Facing the same issue using
|
Seeing the same issue with 11.0.10.j9, but it works fine with 11.0.10.hs. |
Any news around here? The issue has been open for quite a while now and the problem seems to persist. |
Weird, I've reinitialized my environment and the problem has vanished. I'm not quite sure what I actually did, otherwise I'd write it down here, of course, but whatever it was, it seems to have helped... All I did was switching my IntelliJ from |
sdkman users should use version 11.0.10.hs-adpt for java 11 support - FYI |
Expected Behavior
Class should be mocked w/o errors
Current Behavior
Stackoverflow Exception stops execution
Failure Information (for bugs)
I try to mockk a class which has a default ctor with several interfaces. The 'to be mocked' class itself is a Spring Component (annotated), the interfaces for the ctor are Spring Repositories (annotated). Running the tests produces the mentioned StackOverflowError. Commenting out the mockk<> removes the error.
Steps to Reproduce
Project with Mockk (1.9.3), Spring Boot(2.1.6)/Framework(5.1.8), Spring Mongo(2.1.9) and Junit (4.12).
See code below.
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
Failure Logs
Stack trace
Minimal reproducible code (the gist of this issue)
The text was updated successfully, but these errors were encountered: