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
Properly handle sealed classes with Kotlin 1.7 and JDK 17 #916
Conversation
3c0aeec
to
80c7ea3
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
Would you be able to add a test using the example that failed? (A sealed class with an abstract child?) |
Tried, but that test also succeeded without my modifications. I'm still missing something. Not sure if it's actually related to the abstract class. |
This comment was marked as outdated.
This comment was marked as outdated.
Yes the stacktrace helps, thanks, although I can't figure out exactly what's wrong. At least I think it shows that we're on the right path! I don't see any reference to |
This comment was marked as outdated.
This comment was marked as outdated.
modules/mockk-agent/src/jvmMain/kotlin/io/mockk/proxy/jvm/ObjenesisInstantiator.kt
Outdated
Show resolved
Hide resolved
5f70333
to
f1a638e
Compare
f1a638e
to
6c2b269
Compare
Sorry for commit spam. The current implementation here now seems to fix both, mockk's tests and our own. Please kindly review to spot anything I might have missed. (I've also hidden a few of my now outdated comments) |
So... I tried to add a new test case based on our code and I'm claiming that something in the CI test matrix is currently broken. Have a look at stuebingerb#10 where the @aSemy Any idea what might be wrong there? |
That is indeed weird! Good catch. I think the new Gradle GHA is re-using the cache for different JDK versions. I see this message in the logs: |
I thought that because there was an issue with the Gradle tests not failing #916 (comment) that it wasn't clear if this PR would work as expected. I don't have any suggestions on how to move forward... |
I guess someone will have to fix the CI. But I currently cannot. Until then I'm claiming that this PR will at least improve things and seems to fix the issues for us. |
Let's do it then 👍 |
Ok makes sense, sorry I lost track of what was going on here :) |
This change(I guess) breaks mocking a sealed class with kotlin 1.6.21. |
Attempt to fix #832 by supporting sealed classes based on previous work done by @aSemy.