Skip to content

Conversation

@jonpryor
Copy link
Contributor

Context: #687 (comment)

What happens when there's a "regular" Java comment in between a
Javadoc comment and a member?

/* partial */ class Object {
    /** Create and return a copy of this object… */
    // BEGIN Android-changed: Use native local helper for clone()
    // …
    protected Object clone() throws CloneNotSupportedException {…}
}

What happens is that the Javadoc becomes orphaned.

Commit 69e1b80 attempted to handle such orphaned Javadocs via
heuristic, using the first orphaned Javadoc comment in the parent
scope. This didn't work reliably, as the parent scope could contain
multiple "unrelated" orphaned Javadoc comments:

class Outer {
    /** Orphaned #1 */
    // cause orphaning
    class Inner {}

    void m() {}
}

Because containing types are fully processed before contained types,
Outer.m() would grab the Javadoc for Outer.Inner before
Outer.Inner would have a chance to grab it.

Re-work the logic to associate orphaned Javadocs with their members,
by requiring that the Javadoc comment begin before the member of
interest, and after any preceding members. This should prevent
incorrect correlation of orphaned Javadoc comment blocks.

Additionally, update gradle to use javaparser 3.18.0, from 3.16.1.

@jonpryor
Copy link
Contributor Author

Context: dotnet#687 (comment)

What happens when there's a "regular" Java comment in between a
Javadoc comment and a member?

	/* partial */ class Object {
	    /** Create and return a copy of this object… */
	    // BEGIN Android-changed: Use native local helper for clone()
	    // …
	    protected Object clone() throws CloneNotSupportedException {…}
	}

What happens is that the Javadoc becomes *orphaned*.

Commit 69e1b80 attempted to handle such orphaned Javadocs via
heuristic, using the first orphaned Javadoc comment in the parent
scope.  This didn't work reliably, as the parent scope could contain
multiple "*unrelated*" orphaned Javadoc comments:

	class Outer {
	    /** Orphaned dotnet#1 */
	    // cause orphaning
	    class Inner {}

	    void m() {}
	}

Because containing types are fully processed before contained types,
`Outer.m()` would grab the Javadoc for `Outer.Inner` before
`Outer.Inner` would have a chance to grab it.

Re-work the logic to associate orphaned Javadocs with their members,
by requiring that the Javadoc comment begin *before* the member of
interest, and *after* any preceding members.  This should prevent
incorrect correlation of orphaned Javadoc comment blocks.

Additionally, update gradle to use javaparser 3.18.0, from 3.16.1:

  * javaparser/javaparser@javaparser-parent-3.16.1...javaparser-parent-3.18.0
@jonpryor jonpryor merged commit c1bc5c8 into dotnet:master Dec 10, 2020
@jpobst jpobst added this to the 11.1 (16.9 / 8.9) milestone Jan 5, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants