Skip to content

Upgrade Kotlin and Gradle #535

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

Merged
merged 4 commits into from
Jul 9, 2025
Merged

Upgrade Kotlin and Gradle #535

merged 4 commits into from
Jul 9, 2025

Conversation

LarsSven
Copy link
Contributor

This is a followup of #534 (review)

It upgrades Kotlin and Gradle to a newer version.

These are some pretty major upgrades so I do recommend also locally testing it before approving/merging.

@LarsSven
Copy link
Contributor Author

The current CI failure seems to be a random failure that probably needs to be rerun?

@TimvdLippe
Copy link
Contributor

I have rerun it on CI a couple of times and it appears to consistently fail. Please investigate the failure and let us know why it is failing.

@LarsSven
Copy link
Contributor Author

LarsSven commented Apr 15, 2025

The doReturn_withGenericIntReturnType_on test specifically fails on the upgrade from Kotlin 1.9 to 2.0 (2.0.0 is the first version that starts failing). It is not fully clear to me why it starts failing, especially because while on does not work, onGeneric does work fine, and the generated error message by mockito-kotlin also suggests that you may need to use onGeneric in this case.

I am not deep enough in this codebase to understand what on and onGeneric do specifically and why one would fail with an NPE and the other wouldn't. Maybe 2.0 changes something in how they enforce nullability in Kotlin?

@LarsSven
Copy link
Contributor Author

I had another look at it but it almost feel like maybe the test is not correct. Why did on work on generic methods to begin with, aren't you supposed to always use onGeneric for generic methods?

@LarsSven
Copy link
Contributor Author

LarsSven commented Jun 4, 2025

@TimvdLippe would you perhaps be able to take a look at this?

@TimvdLippe
Copy link
Contributor

Unfortunately I am not versed in Kotlin, so I can't assist with investigating Kotlin specific failures. Maybe somebody else with more knowledge of the Kotlin compiler can help out? It's not the first time Kotlin does something that is unusual compared to the other JVM languages.

@Gungy2
Copy link

Gungy2 commented Jun 24, 2025

I had another look at it but it almost feel like maybe the test is not correct. Why did on work on generic methods to begin with, aren't you supposed to always use onGeneric for generic methods?

I think I agree with this assessment, especially because the doReturn_withGenericIntReturnType_onGeneric method works correctly. Probably the way forward is just deleting that test?

@LarsSven
Copy link
Contributor Author

LarsSven commented Jul 9, 2025

@TimvdLippe I removed the broken test

Copy link
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

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

Thanks all for the assistance! I will publish a new version of mockito-kotlin with this change.

@TimvdLippe TimvdLippe merged commit 7677d8d into mockito:main Jul 9, 2025
4 checks passed
TimvdLippe added a commit that referenced this pull request Jul 9, 2025
The verification fails on `main`, even though the run in #535 was green.
@TimvdLippe TimvdLippe mentioned this pull request Jul 9, 2025
1 task
TimvdLippe added a commit that referenced this pull request Jul 9, 2025
The verification fails on `main`, even though the run in #535 was green.
Probably because the action version had to be updated as well.
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