-
Notifications
You must be signed in to change notification settings - Fork 75
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
ClassFormatError
when using sealed classes in Kotlin
#638
Comments
Hi! Thanks for taking the time to create the repository, it helps a lot, especially because I have almost no experience with Kotlin. I was able to reproduce the issue, but I'm not sure how to solve it either. You could try to add prefab values for If not, we'd have to dig deeper. I agree with you that the name of the dynamic subclass ( Lines 78 to 84 in 4a75422
I don't understand where the slash comes from (and why there's no . in it), but since the first part of the name is the package, and your sealed class doesn't live in a package, maybe you can try putting it in one and see what happens?
If that also doesn't help, we should see if we can run this bit of code from Kotlin: Lines 91 to 99 in 4a75422
I can investigate when I have some free time, but since I have little free time these days, and no experience with Kotlin, it might take a little more time than usual. If you're willing to try one or more of these things yourself, it would speed things up :). |
This is fixed in EqualsVerifier 3.12.1. Turns out it has nothing to do with Kotlin sealed types, but everything with the fact that the sealed class wasn't defined in a package. The same problem occurs when testing a Java class that isn't in a package. You can fix it by moving the class into a package, or just by updating to version 3.12.1 :). |
Describe the bug
I am trying to use Kotlin's sealed classes along with equalsverifier which results into a
ClassFormatError
, see stacktrace below.To Reproduce
I created a repository that contains the minimum amount of code to reproduce the described issue. It contains an EqualsverifierTest.kt class that can be run with JUnit.
Code that triggers the behavior
Any class that has members that uses kotlin's sealed classes.
Error message
Stacktrace
Expected behavior
It should just work as it does with any other type.
Version
v3.10
Additional context
Seems like the root cause is with the dynamic subclassing in particular their names.
The text was updated successfully, but these errors were encountered: