Skip to content

Centralizing dependencies, bumping dependency versions#1448

Closed
jgrnrt wants to merge 16 commits intomockk:masterfrom
jgrnrt:junit-6
Closed

Centralizing dependencies, bumping dependency versions#1448
jgrnrt wants to merge 16 commits intomockk:masterfrom
jgrnrt:junit-6

Conversation

@jgrnrt
Copy link
Contributor

@jgrnrt jgrnrt commented Nov 8, 2025

changes:

  • Gradle 9.2.1
  • switch to libs.versions.toml
  • kotlin 2.2.21
  • coroutines 1.10.2
  • logback 1.5.20
    ...

- java 17 required by junit 6
- kotlin 2.2.20
- coroutines 1.10.2
- logback 1.5.20
- junit jupiter 6.0.1

Signed-off-by: Jeremy Grunert <jgrnrt@gmail.com>
Copy link
Collaborator

@Raibaz Raibaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please also add the higher Java and Kotlin versions in the github actions jobs, in .github/workflows/gradle.yml?

- necessary deprecations changes for gradle v9
- add foojay-resolver-convention plugin
- add heap config to base convention
- bump several dependencies
- migrate to develocity plugin
- bump min Kotlin version to v2.1 - required by junit 6
- junit 6 api change: fix override in MockKExtensionAfterAllTestTest.kt

Signed-off-by: Jeremy Grunert <jgrnrt@gmail.com>
@jgrnrt jgrnrt marked this pull request as draft November 9, 2025 13:22
@jgrnrt
Copy link
Contributor Author

jgrnrt commented Nov 9, 2025

I've made some necessary changes to bump to gradle 9. Somehow the tests now need more heap space. I've increased the heap space for tests.
One test still has the error "Caused by: java.lang.OutOfMemoryError: Java heap space" at ProxyWeakReferenceTest.kt:12.
I've already tried bumping the maxHeapSize to 12g (for testing), but that still didn't work.
Could someone have a look at that?

@Raibaz
Copy link
Collaborator

Raibaz commented Nov 9, 2025

The ProxyWeakReferenceTest is indeed stressing the memory to verify that there are no leaks; it surprises me that upgrading dependencies makes it throw OOME.

I suggest adding -XX:+HeapDumpOnOutOfMemoryError to the jvm args and trying to understand which dependency upgrade caused the failure.

@jgrnrt
Copy link
Contributor Author

jgrnrt commented Nov 9, 2025

I cloned master version of the project in another directory and ran some tests.
I experience weird behavior, which may have been fixed with gradle 9.

Output with Gradle 8:

./gradlew jvmTest --rerun-tasks
> Task :modules:mockk:jvmTest FAILED
[...]
* What went wrong:
Execution failed for task ':modules:mockk:jvmTest'.
[...]
BUILD FAILED in 1m 1s
47 actionable tasks: 47 executed

Same java.lang.OutOfMemoryError: Java heap space in ProxyWeakReferenceTest.kt:12 with debug logs.

Running

./gradlew check --rerun-tasks
[...]
ProxyWeakReferenceTest[jvm] > test()[jvm] SKIPPED
There were failing tests. See the report at: file:///home/jere/Projects/mockk-clean/mockk/modules/mockk/build/reports/tests/jvmTest/index.html

[...]
BUILD SUCCESSFUL in 1m 2s

And running with debug shows the heap error as well:

 Caused by:
[TestEventLogger]         java.lang.OutOfMemoryError: Java heap space
[TestEventLogger]             at io.mockk.it.ProxyWeakReferenceTest.test(ProxyWeakReferenceTest.kt:12)
[TestEventLogger] Gradle Test Run :modules:mockk:jvmTest[jvm] FAILED
[org.gradle.internal.buildevents.BuildResultLogger] BUILD SUCCESSFUL in 1m 7s

Gradle 9 may have fixed this behavior, so gradle check might now correctly show BUILD FAILED.
It would be helpful if someone else could confirm this behavior with gradle 8.

Additionally, my computer crashed several times before I realized that rerunning those tests were filling up my memory.
Running ./gradlew --stop between test runs prevents this from happening.

The ProxyWeakReferenceTest is leaking memory. Or at least the created objects are not being removed from GC, which can be seen in heap dump. I am currently looking into it, but maybe someone with more experience with the project could have a look as well.

@Raibaz
Copy link
Collaborator

Raibaz commented Nov 17, 2025

Can you please rebase on top of master and retry?

I think I found the cause of the memory leak spotted by ProxyWeakReferenceTest and fixed it.

@Raibaz
Copy link
Collaborator

Raibaz commented Nov 17, 2025

...nevermind, that didn't work.

I'll keep looking into a fix.

sdetilly and others added 9 commits November 18, 2025 15:53
- java 17 required by junit 6
- kotlin 2.2.20
- coroutines 1.10.2
- logback 1.5.20
- junit jupiter 6.0.1

Signed-off-by: Jeremy Grunert <jgrnrt@gmail.com>
- necessary deprecations changes for gradle v9
- add foojay-resolver-convention plugin
- add heap config to base convention
- bump several dependencies
- migrate to develocity plugin
- bump min Kotlin version to v2.1 - required by junit 6
- junit 6 api change: fix override in MockKExtensionAfterAllTestTest.kt

Signed-off-by: Jeremy Grunert <jgrnrt@gmail.com>
reverting jvmargs, bump gradle 9.2.1

Signed-off-by: Jeremy Grunert <jgrnrt@gmail.com>
dokka bump to 2.1.0, make necessary migrations for dokka 2.1.0,
centralizing dependencies in libs.versions.toml, remove redundant versioning,
remove duplicate androidxOrchestrator dependency,
fix several deprecation notices,
bump kotlinx-benchmark 0.4.14

Signed-off-by: Jeremy Grunert <jgrnrt@gmail.com>
# Conflicts:
#	buildSrc/build.gradle.kts
#	buildSrc/src/main/kotlin/buildsrc/config/Deps.kt
#	buildSrc/src/main/kotlin/buildsrc/convention/base.gradle.kts
#	buildSrc/src/main/kotlin/buildsrc/convention/kotlin-jvm.gradle.kts
#	buildSrc/src/main/kotlin/buildsrc/convention/kotlin-multiplatform.gradle.kts
#	gradle/wrapper/gradle-wrapper.properties
Signed-off-by: Jeremy Grunert <jgrnrt@gmail.com>
@jgrnrt
Copy link
Contributor Author

jgrnrt commented Nov 22, 2025

Test problems

ProxyWeakReferenceTest prevents subsequent tests from running across all branches. Disabling this problematic test allows the remaining tests to execute properly.
Additionally, we can now see that VerificationAcknowledgeTest has been failing for some time. The two failing tests in VerificationAcknowledgeTest only pass when run in isolation.

Changes

Centralized all dependencies into libs.versions.toml for easier dependency management
Fixed several deprecation warnings.
Check commit messages for details.

JUnit 6

How should we proceed with the JUnit 6 dependency? Options:

  • Revert to JUnit 5.14.1 to maintain current Java and Kotlin baseline compatibility
  • Continue with JUnit 6 and accept the updated baseline requirements

I'm not certain postponing the JUnit 6 migration is the best approach. What are your thoughts?

@Raibaz
Copy link
Collaborator

Raibaz commented Nov 22, 2025

How should we proceed with the JUnit 6 dependency? Options:

  • Revert to JUnit 5.14.1 to maintain current Java and Kotlin baseline compatibility
  • Continue with JUnit 6 and accept the updated baseline requirements

I'm not certain postponing the JUnit 6 migration is the best approach. What are your thoughts?

Given that JUnit 6 was released less than two months ago and the vast majority of the existing codebases still rely on JUnit 5, I think we should hold off on breaking compatibility with JDK <17 and Kotlin <2 for now.

@jgrnrt jgrnrt changed the title Switch to Junit 6 and bumping versions Centralizing dependencies, bumping dependency versions Nov 23, 2025
- migration to dokka v2 (currently investigating issues)
- add repositoriesMode into repositories.settings.gradle.kts
- jvmTests currently running endlessly (investigating)
- downgrade to junit 5
- revert kotlin versions in matrix
- bump gradle action version

Signed-off-by: Jeremy Grunert <jgrnrt@gmail.com>
- fix incorrect usage of @sample in KDoc
- migration to dokka v2 (currently investigating issues)
- add repositoriesMode into repositories.settings.gradle.kts
- jvmTests currently running endlessly (investigating)
- downgrade to junit 5
- revert kotlin versions in matrix
- bump gradle action version
- remove idea plugin to enable configuration-cache
Signed-off-by: Jeremy Grunert <jgrnrt@gmail.com>
- Fix incorrect links in KDoc
- Add Kotlin plugin in android-application.gradle.kts to support Dokka generation
- Add docs project for generating full API documentation for upcoming documentation website overhaul
- Add JUnit BOM to prevent missing junit-platform-launcher
- Disable "given car when test without require parallel testing execution returns successfully" test that runs endlessly

Signed-off-by: Jeremy Grunert <jgrnrt@gmail.com>
@jgrnrt
Copy link
Contributor Author

jgrnrt commented Nov 30, 2025

Only one additional test was running endlessly. I've disabled it.

Project builds very quick now with activated configuration cache.

Dokka generation for the whole project works as well. Split package links can't be resolved with Dokka. Which hopefully will be fixed in the future. See Kotlin/dokka#4364

- incorporate mockk#1455
- add additional api levels in pipeline
- bump sdk to 36
- bump dependencies

Signed-off-by: Jeremy Grunert <jgrnrt@gmail.com>
@jgrnrt
Copy link
Contributor Author

jgrnrt commented Dec 1, 2025

I am not sure on how to fix the illegal class access error:

io.mockk.MethodDescriptionTest > test[Medium_Phone_API_36.1(AVD) - 16] FAILED 
        java.lang.IllegalAccessError: Illegal class access ('kotlin.jvm.internal.CallableReference' attempting to access 'kotlin.jvm.internal.CallableReference$NoReceiver') in attempt to invoke static method kotlin.jvm.internal.CallableReference$NoReceiver kotlin.jvm.internal.CallableReference$NoReceiver.access$000() (declaration of 'kotlin.jvm.internal.CallableReference' appears in /data/app/~~rdGCj-nzuoij6zmLmUwS4w==/io.mockk.android.test-Z2ccNMDpWYiNX1D14Y-beA==/base.apk)
        at kotlin.jvm.internal.CallableReference.<clinit>(CallableReference.java:48)

@jgrnrt jgrnrt closed this Dec 16, 2025
@jgrnrt jgrnrt deleted the junit-6 branch January 15, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants