Skip to content

1318: Update to Kotlin 2.1.20 #1320

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 1 commit into from
May 23, 2025

Conversation

steve-the-edwards
Copy link
Contributor

@steve-the-edwards steve-the-edwards commented May 21, 2025

Associated AGP, Gradle, and friends changes.

Specify kotlin.languageVersion=1.9 while we still use it in 1.9 apps.

(Also I added a .yarnrc file so we don't override the yarnpkg registry unintentionally)

This stands on its own as a worthwhile thing to do, but I'm doing it now because it unlocks being able to use vanniketch's publishing plugin 0.28.0 (PR), which is important for being able to seamlessly update Sonatype Central location (PR).

Note that we had a lot of @UnsafeVariance notes and conflicting variance specifications - e.g., in specified generics used in the out position and vice versa. The ability to do this was removed with Kotlin 2.0 - @UnsafeVariance is just ignored. See, e.g., https://youtrack.jetbrains.com/issue/KTLC-72/K2-Stop-relying-on-the-presence-of-UnsafeVariance-using-for-contravariant-parameters

I did some spelunking (149ab27, e50a0bb, #56 and friends) back to the beginning and I cannot find any specific explicit decision or justification for use of in PropsT and out OutputT, out RenderingT.

As such, my conclusion is just that we started there naturally because that is logically how those generics are "used" (e.g., props are passed in, output passed out; this regardless of whether or not the code using them is only producer, or only consumer as per the Kotlin generics declaration-site variance rules - https://kotlinlang.org/docs/generics.html#declaration-site-variance).

Also, with the exception of sometimes using, e.g., Nothing as a subtype of all types in order to type utilities that did not have to deal with the RenderingT we don't actually make use of this variance much with Workflows., E.g., we are not relying on Workflow<String, String, String> being a subclass of Workflow<Object, Object, Object>. This is at least because when workflows are passed as a parameter, we are expecting a particular type of a Workflow (including specific generic types). We do not have (AFAIK) much utility that operates on a set of Workflow's whose generic types share some common supertype.

I can prove this better running this snapshot in our internal build.

@zach-klippenstein , @rjrjr do you have any other recollections/thoughts on this?

Closes #1318

@steve-the-edwards steve-the-edwards force-pushed the sedwards/update-actions-for-central branch from b12dff3 to 46ae961 Compare May 21, 2025 20:42
@steve-the-edwards steve-the-edwards changed the base branch from sedwards/update-publishing to main May 21, 2025 20:42
@steve-the-edwards steve-the-edwards force-pushed the sedwards/update-actions-for-central branch 10 times, most recently from 9241f73 to 6b9849a Compare May 22, 2025 19:32
Update Gradle, AGP, Compose (now bundled with Kotlin).
Update code and build files as necessary.
@steve-the-edwards steve-the-edwards force-pushed the sedwards/update-actions-for-central branch from 6b9849a to 8a93381 Compare May 22, 2025 19:52
@steve-the-edwards steve-the-edwards marked this pull request as ready for review May 22, 2025 20:09
@steve-the-edwards steve-the-edwards merged commit 4da82b7 into main May 23, 2025
44 checks passed
@steve-the-edwards steve-the-edwards deleted the sedwards/update-actions-for-central branch May 23, 2025 13:47
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.

Update to Kotlin 2.0+
3 participants