I am running into troubles with the upgrade to M5 for an android project.
Here’s an example:
I am using
TextView.getCompoundDrawables()
This returns an array[4] of drawables (top, left, bottom and right), with the values at null if there are no drawable defined for one of the sides.
With M4 the signature was:
fun getCompoundDrawables(): Array<Drawable?>?
With M5 it is:
fun getCompoundDrawables(): Array<Drawable>?
Cleary this is wrong and the signature should be:
fun getCompoundDrawables(): Array<Drawable?>
I understand that the new default might be better, and that I am supposed to use annotations to specify the correct signature.
But that’s where I run into troubles.
I do not know how to set the annotation.
In my own java code, I get the option to “Edit custom Kotlin Signature”, but not in the java code from the SDK.
How do I setup my project to use external annotations?
I think my project is setup to write annotations in a dependencies/annotations directory that I specified once, but how do I check that it is working properly. Where is it defined?
I’ve looked at the jar for the jdk annotations and I have only found examples of @NotNull annotations.
What does an annotation like: @KotlinSignature(“var values : Set<String?>?”)
Look like in an annotations.xml?
Strange, but when I try to reproduce it, it works for me. When I press Alt+Enter on getCompoundDrawables() in TextView, I see the following intention menu:

After that I'm offerered to create new annotations root for android SDK. At last, I get popup where I enter alternative Kotlin signature:

What menu do see when you invoke Alt+Enter on getCompoundDrawables()?
On one machine (this one has Kotlin M5) I see nothing, no option at all.
On the other one (still on M4), I see the option to specify the custom Kotlin Signature, but when I click on it, I get an exception:
Couldn’t find function descriptor for getCompoundDrawables in android.widget.TextView: Couldn’t find function descriptor for getCompoundDrawables in android.widget.TextView
java.lang.AssertionError: Couldn’t find function descriptor for getCompoundDrawables in android.widget.TextView