Properly handle sealed classes with Kotlin 1.7 and JDK 17#916
Properly handle sealed classes with Kotlin 1.7 and JDK 17#916Raibaz merged 1 commit intomockk:masterfrom stuebingerb:fix/fix-sealed-classes
Conversation
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
|
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 https://github.com/stuebingerb/mockk/pull/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.