Solutions were there all along, but only JetBrains can use them

Can you please make at least some of the annotations within kotlin.internal.AnnotationsKt available for use by us? They provide the only solutions to problems we all encounter - and yet only JetBrains gets to use these features. (Notably worrying is that if you privately have solutions readily usable, then clearly you won’t recognize the need for them — since, well, you already have them.)

Specifically, I would like to use @LowPriorityInOverloadResolution and @NoInfer, at least.

I’m not sure how @OnlyInputTypes works, but it would be great if something existed like was wished for in this post in Nulls and generics.

Note that in the post, the mention of requested feature only comes in an almost-not-included wishful sidecomment. The two annotations I request solve a class of issues that I encounter but never file reports for because they are language limitations rather than bugs. Who would have known that they already exist, but presumably just aren’t available since they’re already internally usable by JetBrains. They’re used all over JetBrains’ Kotlin code, so there is no question as to whether they have compelling use cases.

2 Likes

Please, file reports for the specific problems you encounter to http://kotl.in/issue

Done just now. Please see KT-16255.

From your phrasing, it seems that concrete examples really are wished for despite the wealth of them that are found in Kotlin stdlib, perhaps? If necessary, I can add some when I have more time available.

Just want to clarify that it’s not technically correct to say that “only JetBrains gets to use these features”. Our internal users at JetBrains see the standard library from the outside, so these annotations are not available to them as well. So the correct one would be “only Kotlin standard library developers gets to use these features”. :wink:

We had not exposed those annotations public because first we hadn’t thought much about the design of language features behind them, and second we’re unsure what their use cases are (at least for some of them). For example @LowPriorityInOverloadResolution is used now like a band-aid solution when type inference/overload resolution doesn’t provide satisfactory results. It should be thoroughly thought out before becoming public.

Thanks for posting your use case, we’ll evaluate it.

2 Likes