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

Fix incorrect handling of static members used within @see tag #2627

Merged
merged 2 commits into from Aug 24, 2022

Conversation

IgnatBeresnev
Copy link
Member

Fixes #2626

@@ -567,8 +568,20 @@ open class MarkdownParser(
}

//Horrible hack but since link resolution is passed as a function i am not able to resolve them otherwise
@kotlin.Suppress("DeprecatedCallableAddReplaceWith")
@Deprecated("This function makes wrong assumptions and is missing a lot of corner cases related to generics, " +
"parameters and static members. This is not supposed to be public API and will not be supported in the future")
fun DRI.fqName(): String? = "$packageName.$classNames".takeIf { packageName != null && classNames != null }
Copy link
Member Author

Choose a reason for hiding this comment

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

The overall problem is basically here.

For com.example.Object.function() it would return com.example.Object, so if you have multiple @see tags that point to multiple different functions from the same object - there would be name collisions, and some members would be discarded by groupBy further down the road.

This function is overall very wrong, and it would take a lot of effort to make it right

Comment on lines 602 to 604
val linkText = dri.takeIf { it.target is PointingToDeclaration }
?.let { seeTag.name.removePrefix("${it.packageName}.") }
?: seeTag.name
Copy link
Member Author

Choose a reason for hiding this comment

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

Turns out, @see can also be used with local params (we have tests for it) and generics. And with functions, of course, so using classNames was wrong here, my bad

@@ -517,76 +517,73 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
}

@Test
fun `undocumented see also from java`(){
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved two tests to JavadocParserTest as they are not about content, but verify documentables model.

@IgnatBeresnev IgnatBeresnev merged commit 97628db into master Aug 24, 2022
@IgnatBeresnev IgnatBeresnev deleted the see-for-static-members branch August 24, 2022 12:18
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.

Multiple @see tags for imported static functions are missing from documentation
2 participants