Stackoverflow error when upgrading to v3.5.2
See original GitHub issueI tried to upgrade from Mockito v3.4.6 to v3.5.2 and I’m getting a stackoverflow error (same error with v3.5.0) when running some tests (not all of them, just a few ; even in the same class : some tests pass and others don’t).
Stacktrace :
java.lang.StackOverflowError
at java.base/java.lang.ThreadLocal.get(ThreadLocal.java:163)
at org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.lambda$new$3(InlineByteBuddyMockMaker.java:260)
at org.mockito.internal.creation.bytebuddy.MockMethodAdvice.handleConstruction(MockMethodAdvice.java:176)
at org.mockito.internal.creation.bytebuddy.inject.MockMethodDispatcher.handleConstruction(MockMethodDispatcher.java:53)
at java.base/java.lang.Throwable.<init>(Throwable.java)
at java.base/java.lang.Exception.<init>(Exception.java:66)
at java.base/java.lang.RuntimeException.<init>(RuntimeException.java:62)
at java.base/java.lang.ClassCastException.<init>(ClassCastException.java:58)
at java.base/java.lang.Throwable.<init>(Throwable.java)
at java.base/java.lang.Exception.<init>(Exception.java:66)
at java.base/java.lang.RuntimeException.<init>(RuntimeException.java:62)
at java.base/java.lang.ClassCastException.<init>(ClassCastException.java:58)
at java.base/java.lang.Throwable.<init>(Throwable.java)
at java.base/java.lang.Exception.<init>(Exception.java:66)
...
I didn’t succeed in reproduce the error in a small project, but I’ll spend more time to try and post the sources here when/if I have a reproducible case.
Environment :
- Mockito v3.5.2
- JUnit v5.6.2
- Java :
openjdk version “11.0.8” 2020-07-14 OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu118.04.1) OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu118.04.1, mixed mode, sharing)
- Maven : v3.6.0 (tests are run by the maven-surefire plugin)
Issue Analytics
- State:
- Created 3 years ago
- Comments:22 (9 by maintainers)
Top Results From Across the Web
Routes match error upgrading from 2.3 to 5.2.3 - Stack Overflow
match method is deprecated in rails 5.0 or above, the reason is to encourage people to use only GET and POST .
Read more >Upgrade Jasper version from 5.2.0 to 6.2.2 causing ...
We have recently upgraded Jasper version from 5.2.0 to 6.2.2, After that Report generation failing with below stack overflow error.
Read more >StackOverflowError while installing in silent mode - Community
Hello We're trying to install our product in silent mode. Unfortunately, we got following error. REGISTRY ALREADY STORED!
Read more >5.2.2 OpenJDK 8 UnmodifiableCollection StackOverFlowError
We'd been running a new stable 3-node cluster using ES 5.1.1 for about 3 weeks but upgraded to 5.2.2 after coming across a...
Read more >Error: java.lang.StackOverflowError - ShinyProxy
Error : java.lang.StackOverflowError · Install Java for rJava · Install OpenJDK-8 · Install dependency libraries · install needed R packages · make ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@raphw Thank you for the fix and the time spent on this. It works great !
I used mockito-inline v3.5.6, all tests passed but 3. The 3 that fails are new ones (not the ones who failed before) and none of them use Mockito (but all of them are on enums, apparently
MyEnum.values()
returns an array with null values inside). But they’re executed correctly when running them manually, class by class (like I did before)Do you know how can I generate the inline JAR from the sources ? I can’t provide you the logs I added in the source with mockito-inline because the JAR is not generated by
./gradlew -x check clean build
.