https://kotlinlang.org logo
#mockk
Title
# mockk
e

eygraber

06/30/2022, 8:49 PM
e

Emil Kantis

06/30/2022, 9:18 PM
Does it work to downgrade jvmTarget to 11?
e

eygraber

06/30/2022, 9:19 PM
It's not possible for me to do that in my project so I can't test it
e

Emil Kantis

06/30/2022, 9:23 PM
not possible? what happens if you do it? 😄
e

eygraber

06/30/2022, 9:24 PM
I'm using libraries that target jvm 17 so Gradle complains and says something about being incompatible
t

thanksforallthefish

07/06/2022, 5:49 AM
though I am wondering the same (about still being active) to be fair the problem is java 17 and kotlin 1.7. on java 11 and kotlin 1.7 mockking sealed class still works and the problem is with an underlined library, objenesis (https://github.com/easymock/objenesis), though once again, there is no new release in the past year, might be wise to figure out if it is possible to replace it
being OSS I won’t hold anyone responsible if they drop support, but I would like to know what the plans are so I could eventually look at finding an alternative
e

eygraber

07/06/2022, 6:16 AM
Exactly, I don't blame anyone, but I need to know if I should look for something else.
Also with Java 17 being an LTS, and with the push to update Java more frequently, I think it's definitely something that maintainers need to test and plan for.
e

ephemient

07/06/2022, 6:22 AM
I'm not involved, but can somebody at least put a standalone reproducible example into the issue? I just gave mockk 1.12.4 a shot in a sample project on Kotlin 1.7/Java 17 and it worked, so my simple setup doesn't capture whatever is going wrong
1
t

thanksforallthefish

07/06/2022, 7:04 AM
@ephemient added. https://github.com/ThanksForAllTheFish/mockk832 does it reproduce the issue for you too?
e

Emil Kantis

07/06/2022, 7:29 AM
reproduced on my machine 👍
e

ephemient

07/06/2022, 7:53 AM
ok, I think I why I wasn't reproducing the issue before. I was still using the default
kotlinc -jvm-target 1.8
even with Java 17, but if you go up to
-jvm-target 17
(which
jvmToolchain
will do), then it breaks
as an immediate workaround, if I add
Copy code
kotlin {
    target.compilations.all {
        kotlinOptions.freeCompilerArgs += ["-jvm-target", "16"]
    }
}
then there's a warning about
-jvm-target
being specified multiple times, but the latter one wins and everything works
but going by a similar bug in Mockito/ECJ, this could be a Kotlin compiler issue and not something mockk can do anything about https://bugs.eclipse.org/bugs/show_bug.cgi?id=572190
t

thanksforallthefish

07/06/2022, 8:02 AM
I can also add a second branch replacing
mockk
with
mockative
, with that one the setting java 17+kotlin 1.7 works. but honestly, this type of issue is a bit beyond my capabilities
I think it is not an issue with mockk per se though, but with objenesis. let me try (later, just noticed I have a meeting in 5 minutes)
4 Views