Open domdorn opened 11 months ago
Do you mind sending us a PR that upgrades to Mockito 5 and resolves the deprecations? Then I can publish a new release for it.
Just tried to make a PR but running into a few problems:
1.) .sbtOpts
contains
--J-XX:+CMSClassUnloadingEnabled
which does not work on jdk21, is this necessary for something?
2.) building the compiler bridge with scala 2.13.8 does not work with jdk21 .. I upgraded to scala 2.13.12
3.) there are quite a few tests failing, all related to reflection
[error] user.org.mockito.PrefixExpectationsTest
[error] user.org.mockito.IdiomaticStubbingTest
[error] user.org.mockito.Issue352
[error] user.org.mockito.MockitoScalaSessionTest
[error] user.org.mockito.MockitoSugarTest
[error] user.org.mockito.PostfixVerificationsTest
with errors like this:
[info] - should object stubbing should be thread safe 2 *** FAILED ***
[info] java.lang.NoSuchFieldException: modifiers
[info] at java.base/java.lang.Class.getDeclaredField(Class.java:2782)
[info] at org.mockito.ReflectionUtils$.$anonfun$setFinalStatic$1(ReflectionUtils.scala:130)
[info] at scala.util.Try$.apply(Try.scala:210)
[info] at org.mockito.ReflectionUtils$.setFinalStatic(ReflectionUtils.scala:130)
[info] at org.mockito.MockitoEnhancer.withObject(MockitoAPI.scala:631)
[info] at org.mockito.MockitoEnhancer.withObject$(MockitoAPI.scala:620)
[info] at user.org.mockito.IdiomaticStubbingTest.withObject(IdiomaticStubbingTest.scala:14)
[info] at org.mockito.MockitoEnhancer.withObjectMocked(MockitoAPI.scala:607)
[info] at org.mockito.MockitoEnhancer.withObjectMocked$(MockitoAPI.scala:606)
[info] at user.org.mockito.IdiomaticStubbingTest.withObjectMocked(IdiomaticStubbingTest.scala:14)
4.) some code is not compiling/logging errors
[error] /Users/domdorn/work/mockito-scala/specs2/src/test/scala/org/mockito/specs2/MockitoScalaNewSyntaxSpec.scala:664:22: Implicit definition should have explicit type (inferred org.mockito.VerifyInOrder) [quickfixable]
[error] implicit val order = inOrder(list1, list2)
[error] ^
[error] /Users/domdorn/work/mockito-scala/specs2/src/test/scala/org/mockito/specs2/MockitoScalaSpec.scala:663:22: Implicit definition should have explicit type (inferred org.mockito.VerifyInOrder) [quickfixable]
[error] implicit val order = inOrder(list1, list2)
[error] ^
[error] two errors found
Are there requirements for building on jdk < 21 or scala < 2.13 < 12 ?
Based on https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html it appears we need to upgrade Scala to 2.13.11 and SBT to 1.9.0 minimum. Let's do the upgrade to SBT first and then we do Scala?
@domdorn I think +CMSClassUnloadingEnabled
should be removed. This setting is only valid when using the Concurrent Mark Sweep garbage collector. This garbage collector has to be explicitly enabled with -XX:+UseConcMarkSweepGC
. I'm a bit confused how the option even ended up in the config, as no explict garbage collector seems to have been configured. The default in Java 8 is Parallel GC. (Having said that, I'm only a random guy from the Internet who just had a quick glance at the repo š
).
I'm wondering what the plan is anyway for building with JVM versions in the CI workflow. Currently, the project is built with versions 8, 11 and 14. Should new versions be added? Only LTS versions or more?
@TimvdLippe Are you maintaining the project? Would be great if this was documented in the README. It currently only lists Bruno Bonnano as the author, who apparently does not exist any more. š¤
@ultrasecreth was maintainer in their spare time. I sometimes click the merge button on automated PRs. Feel free to submit a PR and then we can take a look.
@domdorn looks like scala version got a bump can you push the PR yet? otherwise I may try. :-)
@karlroberts please go ahead. Unfortunately, I don't have any ressources for this atm.
My project only had included
mockito-scala
as dependency. When upgrading to JDK21, we've got the following error:our Dependencies.scala looks like this
Without the explicit inclusion of
mockito-core
an old version of mockito was pulled in which included a bytebuddy version that does not yet understand JDK21 classes.