Skip to content
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

Support of annotation constructor #3027

Open
BlondeHex opened this issue Jun 2, 2023 · 2 comments
Open

Support of annotation constructor #3027

BlondeHex opened this issue Jun 2, 2023 · 2 comments
Labels
awaiting response An issue/PR that cannot be completed without additional information or a discussion enhancement An issue for a feature or an overall improvement

Comments

@BlondeHex
Copy link

Could you consider adding the constructor information to the annotations? After version 1.6.0 it became possible to instance an annotation: https://youtrack.jetbrains.com/issue/KT-45395
I'm not sure if this is necessary, but it might be worth doing.

@BlondeHex BlondeHex added the enhancement An issue for a feature or an overall improvement label Jun 2, 2023
@zarechenskiy
Copy link
Contributor

A little more detail. Right now annotation classes can be instantiated via a constructor call, the constructor of an annotation class can even be declared explicitly in the code: annotation class FooBar constructor(), so it seems quite natural to show the constructor signature in generated documentation.

@IgnatBeresnev
Copy link
Member

It was a conscious decision to remove annotation constructors in 1.7.20 (#2576), aside from the primary constructor which is still displayed.

internal fun List<Documentable>.shouldDocumentConstructors() = !this.any { it is DAnnotation }

As far as I remember, the main reasoning was that annotations might have constructors to substitute reflection invocations and for internal/compiler purposes, but they are not expected to be documented and instantiated directly under normal circumstances.

If it hurts the feature adoption, I personally don't mind bringing it back (although the annotation pages are somewhat cleaner without constructors), but the change was made after @qwwdfsad brought it up, so maybe Vsevolod has something to say about it :)

@IgnatBeresnev IgnatBeresnev added the awaiting response An issue/PR that cannot be completed without additional information or a discussion label Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting response An issue/PR that cannot be completed without additional information or a discussion enhancement An issue for a feature or an overall improvement
Projects
None yet
Development

No branches or pull requests

3 participants