Skip to content

For synthetic $default methods, lookup the annotations on their corresponding non-synthetic method #85

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

Merged
merged 4 commits into from
May 30, 2022

Conversation

martinbonnin
Copy link
Contributor

@martinbonnin martinbonnin commented May 19, 2022

Follow up from #81 as the logic is pretty similar

closes #58

PS: not sure why I disabled maintainer edits on that other PR but this one has the checkbox enabled ✅ so feel free to push here if needed

@qwwdfsad qwwdfsad self-requested a review May 20, 2022 12:16
/**
* For synthetic $default methods, pull the annotations from the corresponding method
*/
val alternateDefaultSignature = mVisibility?.name?.let { className ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be okay for you to take an extra step and consolidate your approach with the hackish filtering of publishedApiSignatures few lines below?

It seems like the handling is mostly identical and we have two similar codepaths, e.g. isPublishedApiWithDefaultArguments and alternateDefaultSignature

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take a look!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor is pushed. It took a bunch of changes. I'm pretty sure this is sub-optimal in terms of performance (the $annotations method could potentially be looked up twice for field + getter). Let me know how much of an issue it is.

As a nice side effect, I could enable all of the "inline" tests

Copy link
Contributor Author

@martinbonnin martinbonnin May 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something else I wanted to mention: the new changes now collect both visible + invisible annotations for markers (because @PublishedApi is invisible it seems). I'm not super versed in the visible vs invisible difference but this too might have a performance hit?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performance doesn't seem to be an issue here; thanks for expressing your concerns though!

@qwwdfsad qwwdfsad self-requested a review May 30, 2022 08:41
Copy link
Member

@qwwdfsad qwwdfsad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superb, thanks! 👍

@qwwdfsad qwwdfsad merged commit 66031d9 into Kotlin:master May 30, 2022
shanshin pushed a commit to JetBrains/kotlin that referenced this pull request Oct 28, 2024
shanshin pushed a commit to JetBrains/kotlin that referenced this pull request Dec 3, 2024
shanshin pushed a commit to JetBrains/kotlin that referenced this pull request Dec 13, 2024
shanshin pushed a commit to JetBrains/kotlin that referenced this pull request Dec 23, 2024
KotlinBuild pushed a commit to JetBrains/kotlin that referenced this pull request Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-public markers aren't handled correctly for functions with default parameters
3 participants