-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Migrate to JSpecify annotations #24767
Comments
We should migrate to the |
The way the support for As part of this work we should make sure we can remove the workaround introduced in c3168f2 that adds a kotlin compiler flag to restore the compiler bug (along with loooots of type system imprecisions). |
Is this actually planned for 8.3? Would be lovely. |
Yes, it is. |
https://github.com/jspecify/jspecify#jspecify
:( |
See the more recently-updated https://github.com/jspecify/jspecify/wiki/adoption, we feel it is safe to adopt now. Assuming there are no major issues and it improves Kotlin DSL nullness, it should be a net positive overall. |
Whoops, I should have fixed that wording on the main github page a while ago. The jar is very safe to depend on. The absolute most we might change in the actual artifact at this point would be to remove |
Blocked by https://youtrack.jetbrains.com/issue/KT-59352 and another potentially related issue. |
KT-59352 and the related blocking issue are both fixed in Kotlin 2.0.0-RC1. |
It seems that even if it could theoretically be possible to express this using JSpecify, there's no implementation commitment on the Kotlin side. IOW, migrating to JSpecify will not allow to resolve #12388. |
Is there an easy way for me to help out from the JSpecify side? My guess would be that #12388 could be fixed by adding For what it's worth, Kotlin has implemented enough JSpecify support that I would expect that much to work today. I know that you've seen some other issues (as have those of us at Google in our usage of the JSpecify annotations with Kotlin), so I could understand if you want to wait until Kotlin 2+ is widely adopted before switching to JSpecify. I would only add that we have found the support to be good enough to use widely in our codebase, and the Kotlin developers have been of help when we've encountered problems. |
Expected Behavior
Since we have now merged Kotlin
1.8.20
support into Gradle, we should now be able to migrate to JSpecify annotations.Current Behavior (optional)
We currently use
javax.annotation.Nonnull
andorg.jetbrains.annotations.NotNull
annotations on Gradle's own@NonNullApi
. We should investigate if we can instead annotate this annotation with one of JSPecify's annotations, or see if we can completely migrate to an alternative provided by JSpecify.Context
Some things to consider:
javax.annotation.Nullable
annotations we use on methods and fields in the codebase?javax
annotations throughout the codebase?The text was updated successfully, but these errors were encountered: