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
Mockk fails on JDK17 when returning sealed classes #1041
Comments
This is seems very much related to mockito/mockito#2315 ? |
I'm neither using a sealed class nor an Enum but I also get the same
|
Correction: there is a sealed data base class involved in the method return value. Did you find a workaround @dstibbe ? |
I'm seeing this issue while mocking an interface that is explicitly
|
@iyadal I have not yet found a workaround, except for not using Mockk for mocking functions returning sealed classes .... |
@soc I am guessing that is probably because the sealed class A explicitly involves B with itself via the |
Apologies, I appear to have ended up in a repo of a different mocking library. :-O |
If you check the release page there are multiple changes regarding sealed classes. So one might hope that this particular issue will be fixed too |
Nope. Between 1.13.3 and 1.13.4 nothing changed that fixes this issue. |
For me, sealed classes were broken in 1.13.2 by this change, can you confirm that you don't have problem using 1.13.2 ? |
@vudzkostek @iyadal |
Expected Behavior
A test that doesn't crash.
Current Behavior
Test crashes on the line where the mockk instance is configured to return an instance of a sealed class. It crashes with the message
java.lang.UnsupportedOperationException: class redefinition failed: attempted to change the class NestHost, NestMembers, Record, or PermittedSubclasses attribute
.Failure Information (for bugs)
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
Please include any relevant log snippets or files here.
Stack trace
Minimal reproducible code (the gist of this issue)
// -----------------------[ YOUR CODE STARTS HERE ] -----------------------
File
BoeTest.kt
// -----------------------[ YOUR CODE ENDS HERE ] -----------------------
The text was updated successfully, but these errors were encountered: