Fixed
Status Update
Comments
tn...@google.com <tn...@google.com> #2
Yes, please contribute a fix -- lint doesn't support type use annotations at all (which is why we also haven't added TYPE_USE to the androidx annotations despite some requests for it -- adding to annotations is easy but updating lint checks is a lot of work.)
tn...@google.com <tn...@google.com> #4
Thanks! Maybe audit KotlinNullnessAnnotationDetector too to make sure nothing is needed there.
ju...@google.com <ju...@google.com> #5
Created KotlinNullnessAnnotationDetector
.
an...@google.com <an...@google.com> #6
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Koala Feature Drop | 2024.1.2 Canary 6
- Android Gradle Plugin 8.6.0-alpha06
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
Description
The
UnknownNullness
lint check only looks at nullness annotations on the item being inspected, which means that the following definitions using a type-use@Nullable
trigger the check:Since the annotations here are applied directly to the type of the item, they have effectively the same meaning as annotating the item itself with a non-type-use
@Nullable
.The check should also look at the annotations present on the
PsiType
and not report a lint violation if there is a nullness annotation.I see that the issue is being reported here . I can contribute a fix if someone from the lint team will review it.